Skip to main content

Mongo Session Storage for pyrogram

Project description



Persistent Session Storage for Pyrogram with MongoDB

from pyrogram.client import Client
from pyromongo import MongoStorage
from motor.motor_asyncio import AsyncIOMotorClient

client = Client(..)
mongo = AsyncIOMotorClient("mongodb+srv://..") = MongoStorage(mongo["pyrogram"], remove_peers=False) # use remove_peers=True to remove all peers on logout


❌ It will not work with the pyrogram context manager.

async def main():
    async with Client(..) as client: = MongoStorage(..)

# It will only store peers


pip install pyromongo

# Install from git
pip install git+

Install dnspython for mongo+srv://.. URIs

pip install dnspython
# or pip install -U pyromongo[srv]
# for Termux use dnspython fork
apt install resolv-conf
pip install git+

Install with all extra dependencies

pip install "pyromongo[gssapi,aws,ocsp,snappy,srv,zstd,encryption]"

Check other required dependencies for motor

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

pyromongo-0.0.9.tar.gz (4.3 kB view hashes)

Uploaded Source

Built Distribution

pyromongo-0.0.9-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