From e4681d7ff657f65906a477dc39989a3a5bf0630f Mon Sep 17 00:00:00 2001 From: tsujp Date: Tue, 6 Feb 2018 19:54:30 +0900 Subject: [PATCH] Resolve merge conflict by incorporating incoming changes --- readthedocs/extra/advanced-usage/sessions.rst | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/readthedocs/extra/advanced-usage/sessions.rst b/readthedocs/extra/advanced-usage/sessions.rst index c822b87f..fca7828e 100644 --- a/readthedocs/extra/advanced-usage/sessions.rst +++ b/readthedocs/extra/advanced-usage/sessions.rst @@ -59,8 +59,8 @@ session file on your Heroku dyno itself. The most complicated is creating a custom buildpack to install SQLite >= 3.8.2. -Generating a ession File on a Heroku Dyno -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Generating a Session File on a Heroku Dyno +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. note:: Due to Heroku's ephemeral filesystem all dynamically generated @@ -98,3 +98,16 @@ directory. Now you can create a git repo on your account and commit You cannot ``ssh`` into your Dyno instance because it has crashed, so unless you programatically upload this file to a server host this is the only way to get it off of your Dyno. + +You now have a session file compatible with SQLite <= 3.8.2. Now you can +programatically fetch this file from an external host (Firebase, S3 etc.) +and login to your session using the following scaffolded code: + + .. code-block:: python + + fileName, headers = urllib.request.urlretrieve(file_url, 'login.session') + client = TelegramClient(os.path.abspath(fileName), api_id, api_hash).start() + +.. note:: + - ``urlretrieve`` will be depreciated, consider using ``requests``. + - ``file_url`` represents the location of your file.