@@ -31,7 +31,7 @@ File Storage
3131^^^^^^^^^^^^
3232
3333This is the most common storage engine. It is implemented by using **SQLite **, which will store the session and peers
34- details. The database will be saved to disk as a single portable file and is designed to efficiently save and retrieve
34+ details. The database will be saved to disk as a single portable file and is designed to efficiently store and retrieve
3535peers whenever they are needed.
3636
3737To use this type of engine, simply pass any name of your choice to the ``session_name `` parameter of the
@@ -51,7 +51,7 @@ session database will be automatically loaded.
5151Memory Storage
5252^^^^^^^^^^^^^^
5353
54- In case you don't want to have any session file saved on disk, you can use an in-memory storage by passing the special
54+ In case you don't want to have any session file saved to disk, you can use an in-memory storage by passing the special
5555session name "**:memory: **" to the ``session_name `` parameter of the :obj: `~pyrogram.Client ` constructor:
5656
5757.. code-block :: python
@@ -61,16 +61,12 @@ session name "**:memory:**" to the ``session_name`` parameter of the :obj:`~pyro
6161 with Client(" :memory:" ) as app:
6262 print (app.get_me())
6363
64- This database is still backed by SQLite, but exists purely in memory. However , once you stop a client, the entire
65- database is discarded and the session details used for logging in again will be lost forever.
64+ This storage engine is still backed by SQLite, but the database exists purely in memory. This means that , once you stop a
65+ client, the entire database is discarded and the session details used for logging in again will be lost forever.
6666
6767Session Strings
6868---------------
6969
70- Session strings are useful when you want to run authorized Pyrogram clients on platforms like
71- `Heroku <https://www.heroku.com/ >`_, where their ephemeral filesystems makes it much harder for a file-based storage
72- engine to properly work as intended.
73-
7470In case you want to use an in-memory storage, but also want to keep access to the session you created, call
7571:meth: `~pyrogram.Client.export_session_string ` anytime before stopping the client...
7672
@@ -81,8 +77,8 @@ In case you want to use an in-memory storage, but also want to keep access to th
8177 with Client(" :memory:" ) as app:
8278 print (app.export_session_string())
8379
84- ...and save the resulting string somewhere. You can use this string as session name the next time you want to login
85- using the same session; the storage used will still be completely in-memory:
80+ ...and save the resulting (quite long) string somewhere. You can use this string as session name the next time you want
81+ to login using the same session; the storage used will still be completely in-memory:
8682
8783.. code-block :: python
8884
@@ -93,3 +89,11 @@ using the same session; the storage used will still be completely in-memory:
9389 with Client(session_string) as app:
9490 print (app.get_me())
9591
92+ Session strings are useful when you want to run authorized Pyrogram clients on platforms like
93+ `Heroku <https://www.heroku.com/ >`_, where their ephemeral filesystems makes it much harder for a file-based storage
94+ engine to properly work as intended.
95+
96+ But, why is the session string so long? Can't it be shorter? No, it can't. The session string already packs the bare
97+ minimum data Pyrogram needs to successfully reconnect to an authorized session, and the 2048-bits auth key is the major
98+ contributor to the overall length. Needless to repeat that this string, as well as any other session storage, represent
99+ strictly personal data. Keep them safe.
0 commit comments