Skip to main content

Mongo Session Storage for pyrogram

Project description

pyromongo

INTRODUCTION

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://..")
client.storage = MongoStorage(mongo["pyrogram"], remove_peers=False) # use remove_peers=True to remove all peers on logout


client.run()

Note:

❌ It will not work with the pyrogram context manager.

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

# It will only store peers

INSTALLATION:

pip install pyromongo

# Install from git
pip install git+https://github.com/animeshxd/pyromongo

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+https://github.com/animeshxd/dnspython

Install with all extra dependencies

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

Check other required dependencies for motor https://motor.readthedocs.io/en/stable/installation.html#dependencies

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 details)

Uploaded Source

Built Distribution

pyromongo-0.0.9-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file pyromongo-0.0.9.tar.gz.

File metadata

  • Download URL: pyromongo-0.0.9.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for pyromongo-0.0.9.tar.gz
Algorithm Hash digest
SHA256 059093c73997b5e6ca8b84144d247a81e6a122734264c7f1ce500f71d6dd5c07
MD5 6c1a3321ca60463bc0584121bd89f4b9
BLAKE2b-256 5c7759aca14edfb333ae7b79437f01d0798948e50d7fc6a0a69b0ae1f6137694

See more details on using hashes here.

File details

Details for the file pyromongo-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: pyromongo-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for pyromongo-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 34317977d8df7f380890fa72c5fc0ffd32622a8f262f2fdb9d1ed535db31f419
MD5 1460e4d55a85752518ed99283ccfd86e
BLAKE2b-256 d5b42ff3371898167abd9ad670718998e59277ae64a9ca0ef6e5ea656c25bae1

See more details on using hashes here.

Supported by

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