Advertisement
qwerty4657

Untitled

Oct 11th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. import requests
  2. from datetime import datetime
  3. sent = datetime.now().microsecond
  4. r = requests.post("http://localhost:3000/data", data={'avg_temp': 22, 'time': sent})
  5. if r.status_code == 200:
  6. received = datetime.now().microsecond
  7. print("Delay is", (received - sent)/1000, "milliseconds")
  8.  
  9. print(r.status_code, r.reason)
  10. r.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement