Skip to main content

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>}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-telethon-authorization-0.2.4.tar.gz (6.2 kB view details)

Uploaded Source

File details

Details for the file django-telethon-authorization-0.2.4.tar.gz.

File metadata

  • Download URL: django-telethon-authorization-0.2.4.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

File hashes

Hashes for django-telethon-authorization-0.2.4.tar.gz
Algorithm Hash digest
SHA256 c292f6f00074fbadb65cdd1c379f7403c90507977a0a7d5de8695c1b5bfdf255
MD5 69f84deb10345c59b54f039eccad16a1
BLAKE2b-256 b434024e61585e831d6eb0840357c32de94201331341ba4ff50be66b2f34f9d0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page