Provide REST API for Telethon authorization
Project description
=====
Django Telethon Authorization
=====
Provide REST API for authorizing telegram 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 settings variables::
DTA_TG_SESSION_DIR = os.path.join(BASE_DIR, os.pardir, "telegram_sessions")
DTA_TG_API_ID = 111111
DTA_TG_API_HASH = "tg_api_hash"
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
JSON in it's body with flag `success`, which indicates if request was successfull.
If `success` == `False` -> variable `message` will be present inside JSON response with explanation.
endpoint: /request_code/
type: POST
payload: {phone: <phone>}
endpoint: /submit/
type: POST
payload: {phone: <phone>, code: <code>}
endpoint: /logout/
type: POST
payload: {phone: <phone>}
Django Telethon Authorization
=====
Provide REST API for authorizing telegram 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 settings variables::
DTA_TG_SESSION_DIR = os.path.join(BASE_DIR, os.pardir, "telegram_sessions")
DTA_TG_API_ID = 111111
DTA_TG_API_HASH = "tg_api_hash"
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
JSON in it's body with flag `success`, which indicates if request was successfull.
If `success` == `False` -> variable `message` will be present inside JSON response with explanation.
endpoint: /request_code/
type: POST
payload: {phone: <phone>}
endpoint: /submit/
type: POST
payload: {phone: <phone>, code: <code>}
endpoint: /logout/
type: POST
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.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5af75fb53cb3adb9b6548ab368625a795a5f8de5807b33a244ebc4b70a86044 |
|
MD5 | a36b5f9eb006c146a6266a903ce44e2f |
|
BLAKE2b-256 | c88d225a30dcd202f77c496b81828593f1807342be722b88942c5f19c13c49ae |