Skip to main content

Python utilities to simplify connection with MongoDB through SSH tunnel

Project description

ssh-pymongo

ssh-pymongo

PyPI Latest Release PyPI Build PyPI - Downloads PyPI - Python Version

Python utilities to simplify connection with MongoDB through SSH tunnel. Note: uri parameter is assumed as local, after ssh.

Where to get it

The source code is currently hosted on GitHub at: https://github.com/pualien/pymongo-ssh

Binary installers for the latest released version are available at the Python package index

pip install pymongo-ssh

Example 1

from pymongo_ssh import MongoSession

session = MongoSession('db.example.com')
db = session.connection['db-name']
session.stop()
# session.start()

Example 2

session = MongoSession(
    host='db.example.com',
    uri='mongodb://user:password@127.0.0.1/?authSource=admin&authMechanism=SCRAM-SHA-256'
)
...
session.stop()

Example 3

session = MongoSession(
    host='db.example.com',
    user='myuser',
    password='mypassword',
)
...
session.stop()

Example 4

session = MongoSession(
    host='db.example.com',
    port='21',
    user='myuser',
    key='/home/myplace/.ssh/id_rsa2',
    to_port='37017',
    to_host='0.0.0.0'
)
...
session.stop()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymongo-ssh-0.0.15.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

pymongo_ssh-0.0.15-py3-none-any.whl (4.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page