Home > database >  while loop with request http python
while loop with request http python

Time:01-08

Good morning. I created this function to send a notification and turn on a led but while the http page loads, the script blocks until it has finished loading the page. What can I enter in order to have the page load while the script continues?

def alm_dir():
   print("HELP")
   res = requests.get('http://192.168.1.171/LED=ON')

  

CodePudding user response:

Look into threading, this allows the script to start a function on the side and then continue running while the second function runs in the background

https://realpython.com/intro-to-python-threading/

  •  Tags:  
  • Related