Advertisement
Astranome

UREQUESTS_EXAMPLE

Jul 11th, 2020
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. try:
  2.     import urequests as requests
  3. except ImportError:
  4.     import requests
  5.  
  6. r = requests.get("http://api.xively.com/")
  7. print(r)
  8. print(r.content)
  9. print(r.text)
  10. print(r.content)
  11. print(r.json())
  12.  
  13. # It's mandatory to close response objects as soon as you finished
  14. # working with them. On MicroPython platforms without full-fledged
  15. # OS, not doing so may lead to resource leaks and malfunction.
  16. r.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement