Serves some data over HTTP, once.
Based on the built-in Python module http.server
.
pip install serve-me-once
from serve_me_once import serve_once, gen_random_port
serve_once(
"Hello, World",
timeout=2,
mime_type="text/html",
port=gen_random_port()
)
or
from serve_me_once import serve_once_in_background, gen_random_port
import time
addr = serve_once_in_background(
"Hello, World",
timeout=2,
mime_type="text/html",
port=gen_random_port()
)
print("Hosting at:", addr)
time.sleep(3)
The web version of Netron accepts an URL as a query parameter (example). But serving temporary files is a chore. Hence this.