ESP32 Posting Requests to Local Webserver
Code used in this demonstration: Python Server Code: # Tinker Foundry Example Python Code # Python web server to work with ESP32 POST request # This runs on your local computer, connected on the same WiFi network as your ESP32 controller from http.server import BaseHTTPRequestHandler, HTTPServer hostName = "192.168.xx.xxx" # use ipconfig in console (command prompt) to get the "IPv4 Address" of this machine serverPort = 8080 # BaseHTTPRequestHandler class is used to handle the HTTP requests that arrive at the server class MyServer ( BaseHTTPRequestHandler ): def do_POST ( self ): # handle POST request from ESP32 (or anything else, really) content_length = int ( self .headers[ 'Content-Length' ]) # Gets size of data post_data = self .rfile.read1(content_length) # Gets data print ( "Post Data: " ) print (post_data.decode( 'utf-8' )) # This is the message from the POST request self .send_resp