https://github.com/parikls/django-telethon-authorization
django extension which uses telethon to integrate telegram client authorization (phone+code) to your project
https://github.com/parikls/django-telethon-authorization
Last synced: about 1 year ago
JSON representation
django extension which uses telethon to integrate telegram client authorization (phone+code) to your project
- Host: GitHub
- URL: https://github.com/parikls/django-telethon-authorization
- Owner: parikls
- License: bsd-3-clause
- Created: 2018-06-14T14:48:50.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-04-15T12:07:52.000Z (about 5 years ago)
- Last Synced: 2025-04-05T11:06:08.391Z (about 1 year ago)
- Language: Python
- Size: 17.6 KB
- Stars: 11
- Watchers: 0
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
Project is no longer maintaned.
===============================
=====
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: }
* POST /submit/
* payload: {phone: , code: , password: }
* POST /logout/
* payload: {phone: }