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() breakEven 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. -
@sprasad
Please change line 53 in urquests.py to be justai = usocket.getaddrinfo(host, port) -
@jmarcelino That worked! Thank you..
-
Hi, could you please tell me where can I find the urequests.py
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login