Provide REST API for Telethon authorization
Project description
=====
Django Telethon Authorization
=====
Provide REST API for authorizing telethon sessions
Quick start
-----------
1. Add "django-telethon-authorization" to your INSTALLED_APPS setting::
INSTALLED_APPS = [
...
'django-telethon-authorization',
]
2. Include django-telethon-authorization URL's in your project urls.py like this::
path('telegram-auth/', include('django_telethon_authorization.urls')),
3. Add environment variables::
* TG_API_ID = 111111
* TG_API_HASH = api_hash
* TG_SESSION_PATH = /path/to/sessions
Provide `TG_SESSION_PATH` only if you use SQLite as a session backend (Telethon default)
4. Run `python manage.py migrate` to create the models.
Way of work
------------
- When you request a telegram code - `TelegramAuthorization` model will be created.
- It will be automatically linked to `request.user`
Endpoints
------------
All endpoints accept JSON payloads.::
Usually response has status code `200` with a JSON.::
Each response contains boolean `success` property which indicates if request was successfull.::
If `success` == `False` -> variable `message` will be present inside JSON response with explanation.::
* POST /request_code/
* payload: {phone: <phone>}
* POST /submit/
* payload: {phone: <phone>, code: <code>, password: <password>}
* POST /logout/
* payload: {phone: <phone>}
Django Telethon Authorization
=====
Provide REST API for authorizing telethon sessions
Quick start
-----------
1. Add "django-telethon-authorization" to your INSTALLED_APPS setting::
INSTALLED_APPS = [
...
'django-telethon-authorization',
]
2. Include django-telethon-authorization URL's in your project urls.py like this::
path('telegram-auth/', include('django_telethon_authorization.urls')),
3. Add environment variables::
* TG_API_ID = 111111
* TG_API_HASH = api_hash
* TG_SESSION_PATH = /path/to/sessions
Provide `TG_SESSION_PATH` only if you use SQLite as a session backend (Telethon default)
4. Run `python manage.py migrate` to create the models.
Way of work
------------
- When you request a telegram code - `TelegramAuthorization` model will be created.
- It will be automatically linked to `request.user`
Endpoints
------------
All endpoints accept JSON payloads.::
Usually response has status code `200` with a JSON.::
Each response contains boolean `success` property which indicates if request was successfull.::
If `success` == `False` -> variable `message` will be present inside JSON response with explanation.::
* POST /request_code/
* payload: {phone: <phone>}
* POST /submit/
* payload: {phone: <phone>, code: <code>, password: <password>}
* POST /logout/
* payload: {phone: <phone>}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for django-telethon-authorization-0.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9683c7fd1de5f9f772e9159cb92152fcf0d8d26191654a7e4270c6b07a11050 |
|
MD5 | ebef30b52fa3c93a72d231347246c2f0 |
|
BLAKE2b-256 | 3bd2205fcfa5492d0d1223998457483ffe3ef4641e5cf4c2ffc56af9e7576d1e |