In MicroPython 1.27.0 we can make a HTTP request like:
import requests
r = requests.get("http://ip6.me/api/", timeout=15)
print(r.text)
r.close()
Unfortunately, we cannot simplify that code to use the with statement:
with requests.get("http://ip6.me/api/", timeout=15) as r:
print(r.text)
Because it fails with:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Response' object has no attribute '__exit__'
Can that be implemented?
PS: Oh there is a PR at #278 that seems to implement this.