A
A
Andrey Godunko2022-02-12 14:17:47
Python
Andrey Godunko, 2022-02-12 14:17:47

MICROPYTHON. How to send data to localhost via wi-fi?

Unfortunately, there is no MicroPython tag on Habré, so I use the python tag.
I have a dht11 sensor and an esp8266 module. I need to take temperature and humidity data and send it to a host on the local network. That is, I connect to wi-fi and send a request from the sensor to

http://192.168.1.8/index.py?temperature=*температура*&wet=*влажность

There I have a file that adds data to the database.

I have a C++ implementation but I want to rewrite it in micropython. But I can't find information anywhere on how to generate a code for sending data to a local wi-fi. Unfortunately, the official micropython documentation doesn't specify how to submit a request either. Here is the wifi connection code:

sta_if = network.WLAN(network.STA_IF)
sta_if.active(True)
sta_if.connect("Oleksandr", "19861986")
print("network config:", sta_if.ifconfig())

Please give me a place where I can find how to form a send request to the server's localhost. Or specify the method itself.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Karabanov, 2022-02-12
@Noy-name-boy

ESP32 / ESP8266 MicroPython: HTTP GET Requests
Mycropython how make GET request
Documentation doesn't say, you say

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question