Not able to do GET using urequests library
-
Hello,
I'm trying to connect to the Internet and fetch a web page. To begin with, I was able to successfully connect to the hotspot on my mobile phone. Later, I'm trying to use urequests library ( https://github.com/micropython/micropython-lib/tree/master/urequests) to do a GET operation with a URL but failing. Here is my codenets = wlan.scan() for net in nets: if net.ssid == <MY SSID>: print('Network found!') wlan.connect(net.ssid, auth=(net.sec, 'MY PWD'), timeout=5000) while not wlan.isconnected(): machine.idle() # save power while waiting print('WLAN connection succeeded!') #This is displayed url = "http://en.wikipedia.org/wiki/Monty_Python" r = requests.get(url) #Error - TypeError: function takes 2 positional arguments but #four were given print(r) print(r.content) r.close() break
Even though I'm passing only one argument i.e., URL, how am I getting the above mentioned error? Am I missing something here?
Also, if there is a tried and tested library that works well for HTTP GET and POST operation with GPy, please suggest the same so that I can try that out.
-
Hi, could you please tell me where can I find the urequests.py
-
@jmarcelino That worked! Thank you..
-
@sprasad
Please change line 53 in urquests.py to be justai = usocket.getaddrinfo(host, port)