From 42b0c37169c0f5e183605e5acab4b286ade308f6 Mon Sep 17 00:00:00 2001 From: Konstantin M Date: Wed, 14 Mar 2018 00:12:11 +0200 Subject: [PATCH] Update README.rst --- README.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.rst b/README.rst index a2e0d3de..3dd6b9aa 100755 --- a/README.rst +++ b/README.rst @@ -41,6 +41,26 @@ Creating a client client.start() +Store sessions in Redis +----------------------- + +.. code:: python + + from telethon import TelegramClient + from telethon.sessions.redis import RedisSession + import redis + + # These example values won't work. You must get your own api_id and + # api_hash from https://my.telegram.org, under API Development. + api_id = 12345 + api_hash = '0123456789abcdef0123456789abcdef' + + redis_connector = redis.Redis(host='localhost', port=6379, db=0, decode_responses=False) + session = RedisSession('session_name', redis_connector) + client = TelegramClient(session, api_id, api_hash) + client.start() + + Doing stuff -----------