pyrogram/docs/source/topics/test-servers.rst

41 lines
1.4 KiB
ReStructuredText
Raw Normal View History

2018-12-26 18:44:22 +00:00
Test Servers
============
If you wish to test your application in a separate environment, Pyrogram is able to authorize your account into
Telegram's test servers without hassle. All you need to do is start a new session (e.g.: "my_account_test") using
``test_mode=True``:
.. code-block:: python
from pyrogram import Client
with Client("my_account_test", test_mode=True) as app:
print(app.get_me())
.. note::
If this is the first time you login into test servers, you will be asked to register your account first.
2022-01-07 09:18:51 +00:00
Accounts registered on test servers reside in a different, parallel instance of a Telegram server.
2018-12-26 18:44:22 +00:00
2020-04-01 18:08:46 +00:00
.. contents:: Contents
:backlinks: none
:depth: 1
2020-04-01 18:08:46 +00:00
:local:
-----
2018-12-26 18:44:22 +00:00
Test Mode in Official Apps
--------------------------
2022-01-07 09:18:51 +00:00
You can also login yourself into test servers using official desktop apps, such as Telegram Web and Telegram Desktop:
2018-12-26 18:44:22 +00:00
2022-01-07 09:18:51 +00:00
- **Telegram Web**: Login here: https://web.telegram.org/?test=1
- **Telegram Desktop**: Hold ``Alt+Shift`` and right click on "Add account", then choose "Test server".
2018-12-26 18:44:22 +00:00
Test Numbers
------------
Beside normal numbers, the test environment allows you to login with reserved test numbers.
Valid phone numbers follow the pattern ``99966XYYYY``, where ``X`` is the DC number (1 to 3) and ``YYYY`` are random
2022-01-07 09:18:51 +00:00
numbers. Users with such numbers always get ``XXXXX`` or ``XXXXXX`` as the confirmation code (the DC number, repeated
five or six times).