forked from Michealshodipo56/Ted
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxy2.py
More file actions
24 lines (20 loc) · 686 Bytes
/
Copy pathproxy2.py
File metadata and controls
24 lines (20 loc) · 686 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import http.server
import socketserver
class ProxyHandler(http.server.BaseHTTPRequestHandler):
def do_POST(self):
print("\n--- INCOMING POST HEADERS ---")
for k, v in self.headers.items():
print(f"{k}: {v}")
print("-----------------------------\n")
self.send_response(200)
self.end_headers()
self.wfile.write(b"{}")
def do_GET(self):
self.send_response(200)
self.end_headers()
self.wfile.write(b"{}")
def do_HEAD(self):
self.send_response(200)
self.end_headers()
with socketserver.TCPServer(("", 8081), ProxyHandler) as httpd:
httpd.handle_request()