How to open an SSH tunnel using python?

the_drow picture the_drow · Dec 6, 2010 · Viewed 23.5k times · Source

I am trying to connect to a remote mysql database using django.
The documentation specifies that it is required to open an SSH tunnel first to connect to the database.
Is there a python library that can open an SSH tunnel whenever certain settings are set?

Answer

Vinay Sajip picture Vinay Sajip · Dec 6, 2010

You could try paramiko's forward functionality. For a paramiko overview, see here.