Skip to main content

Яндекс ID (OAuth) API

Библиотека для работы с API Яндекс ID (OAuth) для Python 3.10+. Поддерживает асинхронную работу.

Документация API

Установка

  1. С помощью pip:

    pip install yandexid
    
  2. С помощью pip+git:

    pip install https://github.com/LulzLoL231/yandexid.git
    
  3. Из исходников:

    git clone https://github.com/LulzLoL231/yandexid
    pip install ./yandexid
    

Пример использования

  1. Получение OAuth токена:

    from yandexid import YandexOAuth
    
    yandex_oauth = YandexOAuth(
        client_id='<client_id>',
        client_secret='<client_secret>',
        redirect_uri='<redirect_uri>'
    )
    auth_url = yandex_oauth.get_authorization_url()
    # Тут нужно перейти по ссылке auth_url и получить код авторизации
    token = yandex_oauth.get_token_from_code('<code>')
    

    Возвращает объект Token с информацией о OAuth токене. Формат объекта совпадает с форматом ответа из API Яндекс ID.

  2. Получение информации о пользователе:

    from yandexid import YandexID
    
    yandex_id = YandexID('<oauth_token>')
    user_info = yandex_id.get_user_info_json()
    

    Возвращает объект User с информацией о пользователе. Формат объекта совпадает с форматом ответа из API Яндекс ID.

Асинхронная работа

Чтобы использовать асинхронность, используйте классы AsyncYandexOAuth и AsyncYandexID:

from yandexid import AsyncYandexID

yandex_id = AsyncYandexID('<oauth_token>')
user_info = await yandex_id.get_user_info_json()

Название методов полностью совпадает с названием синхронных методов, не забывайте использовать await перед вызовом асинхронных методов.

Логотипы Яндекс ID и название сервиса "Яндекс ID" принадлежат Яндексу.

Metadata

Release files for yandexid 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yandexid 0.3.1
File Size Uploaded Provenance Actions
yandexid-0.3.1.tar.gz 10.4 kB Without provenance Details for yandexid-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for yandexid 0.3.1
File Interpreter ABI Platform Actions
yandexid-0.3.1-py3-none-any.whl Python 3 none any Details for yandexid-0.3.1-py3-none-any.whl

Total release size: 26.0 kB

Release files / yandexid-0.3.1.tar.gz

Download URL yandexid-0.3.1.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5328f18dc6678c72dabf5045e6763f29d194fcc225a35e448dbe04d308c7998e
BLAKE2b-256 checksum
How to use checksums
37b8754fc6569065dbdb37d31fe8abc9a492fb77cf739b1eff4aebcdd4288e31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.11.0 Linux/5.15.0-1031-azure

Release files / yandexid-0.3.1-py3-none-any.whl

Download URL yandexid-0.3.1-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72639cc01a1885b8ee99c9534883325b9d09b5e6fdb7dd91362ac75154b6902b
BLAKE2b-256 checksum
How to use checksums
c2e781170766cd29a2360dffb5a415b83f170a05b2828153384fac0a6350572a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.11.0 Linux/5.15.0-1031-azure

Security for yandexid 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page