This python prebuild script generates an html table in a cpp header file for the available HTTP endpoints configured with ESP8266WebServer.
PROGMEM const char http_apis_html_content_type[] = "text/html";
PROGMEM const char http_apis_html[] = {0x1f, 0x8b, 0x8, 0x0, ....};
const uint16_t http_apis_html_len = 374;- Scans
*.inofiles forESP8266WebServerinstances - Scans
ESP8266WebServerinstances forserver.on(arg1, arg2, arg3)calls - Scans
arg3for HTTPparameters- in case of
arg3is not an inline function, scans for function in*.inofiles - else scan the inline function
[]()for content
- in case of
- Creates an
HTMLtable with thepath, request method and argumentlist - Compresses the table with
gzipto save some space - Saves the content to a cpp header file:
http_apis.h
- Download the script file
- Reference as a prebuild script in
.vscode/arduino.json:"prebuild": "python <your file directory>/make_urls.py"
- Add to your
.inofile the HTTP serving snippet:server.on("/list_apis", HTTP_GET, []() { server.sendHeader("Content-Encoding","gzip"); server.send_P(200, http_apis_html_content_type, http_apis_html, http_apis_html_len); });
- VS Code + Arduino plugin
- python3
