Hi,
I wrote the following code, but I get this error when I run it:
sshtunnel.BaseSSHTunnelForwarderError: Could not establish session to SSH gateway
Any idea on what could be the issue? I'm using python 3.8 and I have a paid subscription on the .com site (not EU).
Thanks!
import mysql.connector
import sshtunnel
import pandas as pd
sshtunnel.SSH_TIMEOUT = 5.0
sshtunnel.TUNNEL_TIMEOUT = 5.0
with sshtunnel.SSHTunnelForwarder(
('ssh.pythonanywhere.com',22),
ssh_username='myuser', ssh_password='mypass',
remote_bind_address=('my_user.mysql.pythonanywhere-services.com',3306)
) as tunnel:
connection = mysql.connector.connect(user='myuser', password='mypass',host='127.0.0.1', port=tunnel.local_bind_port,database='myuser$mydb')
sql = 'SELECT * from history'
df = pd.read_sql(sql, con=connection)
print(df.head())
connection.close()