I'm using the sshtunnel tool in order to connect to my mysql database here on Pythonanywhere, using python code that I'm running on my locally computer.
This code works perfectly. The problem is, when I run this same exact code on one of my other two computers, it takes about 3 minutes for this code to connect me to the database. On my primary computer, it only takes a couple seconds.
I'm wondering if anyone knows why depending on my computer, it would take so long for this code to connect me to the database. (Side Note: I'm sure this is the first thing everyone would probably think of, but I don't believe this is a hardware problem. All of my computers are about the same quality in hardware so the problem is not because I'm trying to use a toaster oven to connect to the database.)
Thanks ahead of time for the help! My code is below:
import sshtunnel sshtunnel.SSH_TIMEOUT = 5.0 sshtunnel.TUNNEL_TIMEOUT = 5.0
with sshtunnel.SSHTunnelForwarder( ('ssh.pythonanywhere.com'), ssh_username='mypersonalinfo', ssh_password='mypersonalinfo', remote_bind_address=('mypersonalinfo.mysql.pythonanywhere-services.com', 3306) ) as tunnel: db = pymysql.connect( user='mypersonalinfo', password='mypersonalinfo', host='127.0.0.1', port=tunnel.local_bind_port, database='mypersonalinfo$mypersonalinfo', )