MTPyroger/docs/source/topics/session-settings.rst

72 lines
1.9 KiB
ReStructuredText
Raw Normal View History

2019-05-12 17:26:55 +00:00
Session Settings
================
2018-06-25 16:06:00 +00:00
2019-04-12 13:52:06 +00:00
As you may probably know, Telegram allows users (and bots) having more than one session (authorizations) registered
2018-06-25 16:06:00 +00:00
in the system at the same time.
2018-06-27 12:45:56 +00:00
Briefly explaining, sessions are simply new logins in your account. They can be reviewed in the settings of an official
2019-05-28 14:41:55 +00:00
app (or by invoking :class:`~pyrogram.api.functions.account.GetAuthorizations` with Pyrogram). They
2019-05-13 16:04:44 +00:00
store some useful information such as the client who's using them and from which country and IP address.
2018-06-25 16:06:00 +00:00
2019-05-17 23:45:01 +00:00
.. figure:: https://i.imgur.com/YaqtMLO.png
2019-05-23 16:59:29 +00:00
:width: 600
2018-06-25 16:06:00 +00:00
:align: center
2019-05-17 23:45:01 +00:00
**A Pyrogram session running on Linux, Python 3.7.**
2018-06-25 16:06:00 +00:00
That's how a session looks like on the Android app, showing the three main pieces of information.
2019-05-17 23:45:01 +00:00
- ``app_version``: **Pyrogram 0.13.0**
- ``device_model``: **CPython 3.7.2**
2018-06-25 16:06:00 +00:00
- ``system_version``: **Linux 4.15.0-23-generic**
2020-04-01 18:08:46 +00:00
.. contents:: Contents
:backlinks: none
:depth: 1
2020-04-01 18:08:46 +00:00
:local:
-----
2018-06-25 16:06:00 +00:00
Set Custom Values
-----------------
To set custom values, you can either make use of the ``config.ini`` file, this way:
.. code-block:: ini
[pyrogram]
app_version = 1.2.3
device_model = PC
system_version = Linux
Or, pass the arguments directly in the Client's constructor.
.. code-block:: python
app = Client(
"my_account",
app_version="1.2.3",
device_model="PC",
system_version="Linux"
)
Set Custom Languages
--------------------
2018-06-27 12:45:56 +00:00
To tell Telegram in which language should speak to you (terms of service, bots, service messages, ...) you can
set ``lang_code`` in `ISO 639-1 <https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes>`_ standard (defaults to "en",
English).
2018-06-25 16:06:00 +00:00
With the following code we make Telegram know we want it to speak in Italian (it):
.. code-block:: ini
[pyrogram]
lang_code = it
.. code-block:: python
app = Client(
"my_account",
lang_code="it",
)