Skip to content

Commit d0c6ae0

Browse files
committed
urequests: Add example_xively.py as very basic example.
The main purpose is actually to show the need to call .close().
1 parent 577457d commit d0c6ae0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

urequests/example_xively.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy