Guidance in creating an AP WebServer for ESP32

I am at a read disadvantage here, because not only am I new to Python, I am new to Zerynth (v2.0.10-p03), and ESP32.

My goal is to create an AP, and serve up my own web page, that has buttons and slider controls on it.
I have already done this using the Particle Photon with their IDE, but I would like to do the same using Python.

I started with the Mini Web Server example, and that worked just fine on the ESP32 DevkitC, so that’s a good start.

Things stated to fall apart on me in 2 ways.
#1) how do i check for GET & POST
#2) how do i respond back with my site data, instead of simple stings like in the example.
#3) do I have to compress my site into raw data, or can i add a new file and put my HTML web site code in there, and call it some how.  In another platform I was able to do this.
function htmlDefault()
    return @"

  Main Page


I have taken by website and converted it to binary, In the photons code my site data is simply this (of course lopped off as its quite large).
const char web_site[] = { 0x3c,0x21,0x44,0x4f,0x43,0x54,0x59,0x50,0x45,0x20,0x68,0x74, …};

I have (hopefully) converted it correctly to Python this way:
web_site=[0x3c,0x21,0x44,0x4f,0x43,0x54,0x59,0x50,0x45,0x20,0x68,0x74, …]

I see this line in the Mini Web Server  example:  print(“Hello Zerynth!”,random(0,100),"",stream=client)
But unclear on how to send my data back instead.

Further confusion comes in when I Google this. I see many references to use:

from http.server import BaseHTTPRequestHandler, HTTPServer
# HTTPRequestHandler class
class testHTTPServer_RequestHandler(BaseHTTPRequestHandler):

Yet, this throws an error.

Might anyone be willing to explain or show a more elaborate Web Server example that put up an actual web page ?.

Thank you.

Anyone?   Anybody know how to send an array back to the server requesting the web page?

see this discussion

That page is private?

No, it was a broken link.

Try now.

1 Like