Im tying to implement an httpserver for handling request and i want that request passe to another url behind proxy, so far i got this code.
import requests
import http.server
import socketserver
url = 'http://live.impresa.pt/live/sic/sic540p.m3u8'
proxies = {
'https': 'http://80.211.204.126:443'
}
r = requests.get(url,proxies=proxies)
class myHandler(http.server.SimpleHTTPRequestHandler):
def do_GET(self):
if self.path == '/sic':
self.send_response(307)
new_path = r.url
self.send_header('Location', new_path)
self.end_headers()
port = 9999
Handler = myHandler
webserver = socketserver.TCPServer(("10.0.0.110",port),Handler)
print ("Python web server ok")
webserver.serve_forever()when i try acess 10.0.0.110:9999/sic the url is not passing to the proxy and came direct, how can i change this for the request is made behind proxy?
