Questions tagged [http.server]
41 questions
0
votes
0 answers
in python threadinghttpserver - stop server from inside handler
I have the following "main" code:
with http.server.ThreadingHTTPServer( ("", port), Handler ) as daemon:
print(f"serving on port {port} process {os.getpid()} ")
while True:
try:
daemon.handle_request()
except…

Darren Oakey
- 2,894
- 3
- 29
- 55
0
votes
0 answers
Python http server how automatically connect from localhost on startup
The following python script runs on a Pi zero with camera. If I connect from a client with webbrowser the "while True" loop in the streaminhandler prints a message when motion is detected.
I don't always connect from a client but I want the loop…

unformatted
- 1
- 1
0
votes
0 answers
Handle ConnectionResetError & BrokenPipeError python http server
New to python serves outside of a framework. Need a simple server to run and load few pdf files forever.
Running a server in remote using http.server
PORT = 8000
Handler = http.server.SimpleHTTPRequestHandler
with socketserver.TCPServer(("",…

NinjaBat
- 370
- 4
- 20
0
votes
2 answers
Path based routing in Python
I am trying to write the python code, that return the json output when I curl localhost:8000. I want to get the value only when I do curl localhost:8000/shakespear. As of the current code I am getting the value at curl…
user16133873
0
votes
3 answers
python http server hide console
I am trying to do a script that is hosting my file on my local network, here's my code :
import os
import getpass
os.system('python -m http.server --directory C:/Users/'+getpass.getuser())
But the probleme is that the http console is showing on my…

Lun4rIum
- 1
0
votes
1 answer
I'm using http.server with python3 and I want to store a request as a variable
I have this code
httpd = HTTPServer(('127.0.0.1', 8000),SimpleHTTPRequestHandler)
httpd.handle_request()
httpd.handle_request() serves one request and then kills the server like intended. I want to capture this request as a variable so I can parse…

Stathis Kapnidis
- 31
- 3
0
votes
1 answer
How do I make a Python server public?
Using this code:
from http import server
class Serv(server.BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
server.HTTPServer(('host', 80), Serv).serve_forever()
I have tried using my public IP, which didn't work, my…

MLG Herobrine
- 78
- 9
0
votes
1 answer
Is there a way to start a new command prompt window from a get request in python HTTP server that doesn't interrupt the main thread?
This is my first time posting and I'm running into quite the issue. Unlike most people who want their code to execute a command and wait for it to finish, I want to launch it in a new terminal window that's completely separate. This is using a…

SpaceSaver2000
- 52
- 6
0
votes
1 answer
Is there some caching or forking happening in `HTTPServer` or` BaseHTTPRequestHandler`?
It could be my code is wrongly implemented, but I'm finding that while I can serve up GET requests from literal data, I cannot update that data and have it shown as updated in subsequent GET requests. I also cannot have POST requests update the…

dlamblin
- 43,965
- 20
- 101
- 140
-1
votes
1 answer
http.server "code 404, message File not found"
I'm hosting a Python http server from a simple HTML folder on my laptop using py -m http.server. It works fine on the browser end, (tested from computers on my LAN) but the output often says
::ffff:192.168.1.212 - - [19/Dec/2021 21:58:38] code 404,…

Tuor
- 875
- 1
- 8
- 32
-2
votes
1 answer
Run http.server and do stuff at once, python
is there any way to figure this out? I want to run a command invisibly and do stuff at once
import os
def run():
os.system("python -m http.server C:/Showtape/payload/payload.exe 80")
print("Server running...")
print("Serving…

yrifl
- 12
- 2