Comments on: Raspberry Pi Pico W: Getting Started with HTTP GET Requests (MicroPython) https://randomnerdtutorials.com/raspberry-pi-pico-w-http-requests-micropython/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Tue, 20 May 2025 17:31:58 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Jose Barbosa https://randomnerdtutorials.com/raspberry-pi-pico-w-http-requests-micropython/#comment-1046071 Tue, 20 May 2025 17:31:58 +0000 https://randomnerdtutorials.com/?p=159888#comment-1046071 In reply to Sara Santos.

Perfect! Thank you, I will try it out, should be fine!

]]>
By: Sara Santos https://randomnerdtutorials.com/raspberry-pi-pico-w-http-requests-micropython/#comment-1046045 Tue, 20 May 2025 15:06:57 +0000 https://randomnerdtutorials.com/?p=159888#comment-1046045 In reply to Jose Barbosa.

Hi.

The urequests is the lightweigt version of requests for micropython. However, recently, all modules started with “u”, the “u” was dropped. It means it is still the lightweigth version, but with the same name as the python module.

To catch exceptions you can try to catch it as an OSError
try:
#the code that makes the request
except OSError as e:
print(“Request failed:”, e)

Alternatively, to get HTTP status codes:

response = urequests.get(“XXXXXXXXXXX”)
if response.status_code == 200:
print(“Success:”, response.text)
else:
print(“Error: Status code”, response.status_code)
response.close()

I hope this helps.
^
REgards,
Sara

]]>
By: Jose Barbosa https://randomnerdtutorials.com/raspberry-pi-pico-w-http-requests-micropython/#comment-1045924 Tue, 20 May 2025 02:40:07 +0000 https://randomnerdtutorials.com/?p=159888#comment-1045924 Olá Sara e Rui.
Once again thanks for these tutorials.
I have a quesrion, hope you can help. You are using “requests” and I have seen articles refering that pico must use “urequests” . What are the differences?
I see that requests in micropython doesn’t have the same properties as in python, namely to handle error codes.
How do you suggest we handle error situations in a GET in the pico case?
Thank you
JB

]]>
By: Jose Barbosa https://randomnerdtutorials.com/raspberry-pi-pico-w-http-requests-micropython/#comment-1006898 Mon, 10 Feb 2025 19:14:31 +0000 https://randomnerdtutorials.com/?p=159888#comment-1006898 Hi, thanks for another tutorial.
I would like to use this, but also have the publishing side on a separate RPi.
The idea is for the pico to call the rpi with a parameter and receive a set of data that the Rpi already has in a table in SQL.
Do you have any tutorial on how to produce a response to the GET request and maybe create the “JSON” with the data?

Thank you
Jose

]]>
By: Mel https://randomnerdtutorials.com/raspberry-pi-pico-w-http-requests-micropython/#comment-987291 Thu, 28 Nov 2024 16:29:34 +0000 https://randomnerdtutorials.com/?p=159888#comment-987291 Hi,
Thanks for this tutorial.
I have been able to run the basic script to query google.com, but I wanted to do something a bit more advanced.
I want to be able to send information from one pico to another wirelessly.
So using another of your tutorials I setup a web server on one pico and using this script I just wanted to query the web page displayed on the other pico.
I have the web server up and running and I am able to display the page on my pc but when I try to query the page on the pico I get the following

Traceback (most recent call last):
File “”, line 41, in
File “requests/init.py”, line 201, in get
File “requests/init.py”, line 94, in request
OSError: [Errno 103] ECONNABORTED

Using your function ‘init_wifi’ I was able to confirm the pico is connecting to the correct wireless network, but just won’t display the page

Do you have any suggestions

Thanks
Mel

]]>
By: Bill Geery https://randomnerdtutorials.com/raspberry-pi-pico-w-http-requests-micropython/#comment-981752 Sat, 09 Nov 2024 13:26:32 +0000 https://randomnerdtutorials.com/?p=159888#comment-981752 In reply to Sara Santos.

Yes, I had done all that you pointed out. I had been doing the examples from the first tutorial without any problems so I knew my Pico was running fine.

I did fix the problem by going into Thonny and having it reload “responses” and that fixed the problem. I’d still like to know what the error message indicated.

Thanks for the quicfk response.

]]>
By: Sara Santos https://randomnerdtutorials.com/raspberry-pi-pico-w-http-requests-micropython/#comment-981733 Sat, 09 Nov 2024 11:20:00 +0000 https://randomnerdtutorials.com/?p=159888#comment-981733 In reply to Bill Geery.

Hi.
Did you insert your network credentials in the code?
Are you using a Raspberry Pi Pico W (W – means it supports Wi-Fi.)
Did you flash it with firmware for the Pico W??

Regards,
Sara

]]>
By: Bill Geery https://randomnerdtutorials.com/raspberry-pi-pico-w-http-requests-micropython/#comment-981545 Fri, 08 Nov 2024 15:14:52 +0000 https://randomnerdtutorials.com/?p=159888#comment-981545 When I run the first

Make GET request

response = requests.get(“http://www.google.com”)

I get the following error:
Traceback (most recent call last):
File “”, line 38, in
File “requests/init.py”, line 182, in get
File “requests/init.py”, line 76, in request
OSError: -2

where line 38 is the GET request.
What’s causing this? I just copied the code out of the example.

]]>
By: Wiesław https://randomnerdtutorials.com/raspberry-pi-pico-w-http-requests-micropython/#comment-945774 Tue, 06 Aug 2024 12:23:15 +0000 https://randomnerdtutorials.com/?p=159888#comment-945774 In reply to Sara Santos.

Thank you. Installing a newer version solved the problem.

]]>
By: Sara Santos https://randomnerdtutorials.com/raspberry-pi-pico-w-http-requests-micropython/#comment-945718 Tue, 06 Aug 2024 08:37:57 +0000 https://randomnerdtutorials.com/?p=159888#comment-945718 In reply to Wiesław.

Hi.
That module is included by default.
Make sure you installed the latest MicroPython firmware for the Raspberry Pi Pico W version.
If you mistakenly installed for the RPi Pico (without the W—without wireless capabilities), it won’t have the requests module by default.

Regards,
Sara

]]>