I'm using an SSH connection with Paramiko. My code:
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname=remote_host, username=remote_user, password=remote_password,
port=remote_port)
How to send HTTP GET
request from connected remote host (use it like a proxy)?
I've found solution according to the answer:
with SSHTunnelForwarder(
ssh_address_or_host=(remote_host, remote_port),
ssh_username=remote_user,
ssh_password=remote_password,
remote_bind_address=("www.python.org", 80),
) as tunnel:
conn = http.client.HTTPConnection("127.0.0.1", port=tunnel.local_bind_port)
conn.request("GET", '/')