Skip to main content

Yandex ID oauth API wrapper

Project description

Яндекс ID (OAuth) API

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

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

Отличие от оригинального пакета

  1. Убраны жесткая фиксация версий что не давало использовать библиотеку в новых питонах (оставил лишь нижние границы).

Установка

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

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

    pip install https://github.com/Miskler/YandexID-new.git
    
  3. Из исходников:

    git clone https://github.com/Miskler/YandexID-new.git
    pip install ./yandexid-new
    

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

  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" принадлежат Яндексу.

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

yandexid_new-0.3.2.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yandexid_new-0.3.2-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file yandexid_new-0.3.2.tar.gz.

File metadata

  • Download URL: yandexid_new-0.3.2.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for yandexid_new-0.3.2.tar.gz
Algorithm Hash digest
SHA256 aef95255ac6835f263f9fb9850dd20db455f411bf2d0fed4d6ea3980d31647b0
MD5 860cbae4306e1c51a5ea30960f7c8094
BLAKE2b-256 470ce8075bc0d400970d9ae4a1410a9a2cd5ef1888e4a36340585198412f70a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for yandexid_new-0.3.2.tar.gz:

Publisher: upload-to-pypi.yml on Miskler/YandexID-new

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file yandexid_new-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: yandexid_new-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for yandexid_new-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cfe955a006008aee7eedae9e1d71d37430820a803e7a987ce504faa0d0815aba
MD5 9edfeee86a0d81d3349a8ade3a60df17
BLAKE2b-256 ef583b131b5bb6546d8dd1344c8a16bbd7cb82df2e6d1ad0b9e3d62316d1cd63

See more details on using hashes here.

Provenance

The following attestation bundles were made for yandexid_new-0.3.2-py3-none-any.whl:

Publisher: upload-to-pypi.yml on Miskler/YandexID-new

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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