I would like to connect an ESP32 to a server hosting the webpage ‘example.com’. I am using an Adafruit HUZZAH32 and Thonny IDE.
Thanks!
Get a webpage with ESP32
Re: Get a webpage with ESP32
Hi,
Are you using CircuitPython or MicroPython.
The easiest way to do this is with urequests. On MicroPython for ESP32, this is included in the default firmware. It works a lot like the Python "requests" library.
On CircuitPython, take a look at https://circuitpython.readthedocs.io/pr ... t/api.html
Are you using CircuitPython or MicroPython.
The easiest way to do this is with urequests. On MicroPython for ESP32, this is included in the default firmware. It works a lot like the Python "requests" library.
Code: Select all
import urequests
r = requests.get("http://example.com/")
# Use one of these depending on what your response looks like:
print(r.content)
print(r.text)
print(r.json())
r.close()
-
- Posts: 33
- Joined: Fri Oct 11, 2019 1:24 am
Re: Get a webpage with ESP32
I presume I can connect to my network, then call this?
Yes, micro python for ESP32.
Yes, micro python for ESP32.
Re: Get a webpage with ESP32
Yes, use the instructions here http://docs.micropython.org/en/latest/e ... networking for connecting to the network first.