dta
django-telethon-authorization
pypi i django-telethon-authorization
dta

django-telethon-authorization

django extension which uses telethon to integrate telegram client authorization (phone+code) to your project

by Dmytro Smyk

0.2.6 (see all)License:BSD License
pypi i django-telethon-authorization
Readme

=====

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')),

  1. 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)

  1. 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: }

GitHub Stars

10

LAST COMMIT

1yr ago

MAINTAINERS

1

CONTRIBUTORS

3

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
0.2.6
4yrs ago
0.2.5
4yrs ago
0.2.4
4yrs ago
0.2.3
4yrs ago
No alternatives found
No tutorials found
Add a tutorial