Advertisement
Guest User

Untitled

a guest
May 27th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. import urllib.request
  2. import sched, time
  3. s = sched.scheduler(time.time, time.sleep)
  4. def func():
  5. while True:
  6. response = urllib.request.urlopen('https://europe-west2-durable-matter-241821.cloudfunctions.net/get_votes-1')
  7. html = response.read().decode("utf-8").replace("<pre>","")
  8. html = html.replace("</pre>","")
  9. lines = html.splitlines()
  10.  
  11. print(lines[1])
  12. print(lines[2])
  13. print(lines[len(lines)-1])
  14.  
  15. l1 = lines[1].split("%")[0]
  16. l2 = lines[2].split("%")[0]
  17.  
  18. diff = lines[2].split("-")
  19. diff = diff[len(diff)-1]
  20.  
  21. print("Diferenta:",float(l1)-float(l2),"%","[",diff,"]")
  22. print("\n")
  23. time.sleep(30)
  24. func()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement