aioauth-client


Nameaioauth-client JSON
Version 0.28.1 PyPI version JSON
download
home_pagehttps://github.com/klen/aioauth-client
SummaryOAuth support for Asyncio/Trio libraries
upload_time2023-03-16 19:37:49
maintainer
docs_urlNone
authorKirill Klenov
requires_python>=3.8,<4.0
licenseMIT
keywords asyncio trio oauth
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            AIOAuth Client
##############

.. _description:

AIOAuth Client -- OAuth support for Asyncio_ / Trio_ libraries.

.. _badges:

.. image:: https://github.com/klen/aioauth-client/workflows/tests/badge.svg
    :target: https://github.com/klen/aioauth-client/actions
    :alt: Tests Status

.. image:: https://img.shields.io/pypi/v/aioauth-client
    :target: https://pypi.org/project/aioauth-client/
    :alt: PYPI Version

.. image:: https://img.shields.io/pypi/pyversions/aioauth-client
    :target: https://pypi.org/project/aioauth-client/
    :alt: Python Versions

.. _contents:

.. contents::

.. _requirements:

Requirements
=============

- python >= 3.8

.. _installation:

Installation
=============

**AIOAuth Client** should be installed using pip: ::

    pip install aioauth-client

.. _usage:

Usage
=====

.. code:: python

    # OAuth2
    from aioauth_client import GithubClient

    github = GithubClient(
        client_id='b6281b6fe88fa4c313e6',
        client_secret='21ff23d9f1cad775daee6a38d230e1ee05b04f7c',
    )

    authorize_url = github.get_authorize_url(scope="user:email")

    # ...
    # Reload client to authorize_url and get code
    # ...

    otoken, _ = await github.get_access_token(code)

    # Save the token for later use

    # ...

    github = GithubClient(
        client_id='b6281b6fe88fa4c313e6',
        client_secret='21ff23d9f1cad775daee6a38d230e1ee05b04f7c',
        access_token=otoken,
    )

    # Or you can use this if you have initilized client already
    # github.access_token = otoken

    response = await github.request('GET', 'user')
    user_info = await response.json()


.. code:: python

    # OAuth1
    from aioauth_client import TwitterClient

    twitter = TwitterClient(
        consumer_key='J8MoJG4bQ9gcmGh8H7XhMg',
        consumer_secret='7WAscbSy65GmiVOvMU5EBYn5z80fhQkcFWSLMJJu4',
    )

    request_token, _ = await twitter.get_request_token()

    authorize_url = twitter.get_authorize_url(request_token)
    print("Open",authorize_url,"in a browser")
    # ...
    # Reload client to authorize_url and get oauth_verifier
    # ...
    print("PIN code:")
    oauth_verifier = input()
    oauth_token, data = await twitter.get_access_token(oauth_verifier)
    oauth_token_secret = data.get('oauth_token_secret')

    # Save the tokens for later use

    # ...

    twitter = TwitterClient(
        consumer_key='J8MoJG4bQ9gcmGh8H7XhMg',
        consumer_secret='7WAscbSy65GmiVOvMU5EBYn5z80fhQkcFWSLMJJu4',
        oauth_token=oauth_token,
        oauth_token_secret=oauth_token_secret,
    )

    # Or you can use this if you have initilized client already
    # twitter.access_token = oauth_token
    # twitter.access_token_secret = oauth_token_secret

    timeline = await twitter.request('GET', 'statuses/home_timeline.json')
    content = await timeline.read()
    print(content)


Example
-------

Run example with command: ::

    make example

Open http://localhost:8080 in your browser.

.. _bugtracker:

Bug tracker
===========

If you have any suggestions, bug reports or
annoyances please report them to the issue tracker
at https://github.com/klen/aioauth-client/issues

.. _contributing:

Contributing
============

Development of AIOAuth Client happens at: https://github.com/klen/aioauth-client

.. _license:

License
========

Licensed under a `MIT license`_.

.. _links:

.. _klen: https://github.com/klen
.. _Asyncio: https://docs.python.org/3/library/asyncio.html
.. _Trio: https://trio.readthedocs.io/en/stable/

.. _MIT license: http://opensource.org/licenses/MIT

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/klen/aioauth-client",
    "name": "aioauth-client",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "asyncio,trio,oauth",
    "author": "Kirill Klenov",
    "author_email": "horneds@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/25/91/94faf3ce9269861a8b3d009dc65755b8011f4822d2ef790499223619e24c/aioauth_client-0.28.1.tar.gz",
    "platform": null,
    "description": "AIOAuth Client\n##############\n\n.. _description:\n\nAIOAuth Client -- OAuth support for Asyncio_ / Trio_ libraries.\n\n.. _badges:\n\n.. image:: https://github.com/klen/aioauth-client/workflows/tests/badge.svg\n    :target: https://github.com/klen/aioauth-client/actions\n    :alt: Tests Status\n\n.. image:: https://img.shields.io/pypi/v/aioauth-client\n    :target: https://pypi.org/project/aioauth-client/\n    :alt: PYPI Version\n\n.. image:: https://img.shields.io/pypi/pyversions/aioauth-client\n    :target: https://pypi.org/project/aioauth-client/\n    :alt: Python Versions\n\n.. _contents:\n\n.. contents::\n\n.. _requirements:\n\nRequirements\n=============\n\n- python >= 3.8\n\n.. _installation:\n\nInstallation\n=============\n\n**AIOAuth Client** should be installed using pip: ::\n\n    pip install aioauth-client\n\n.. _usage:\n\nUsage\n=====\n\n.. code:: python\n\n    # OAuth2\n    from aioauth_client import GithubClient\n\n    github = GithubClient(\n        client_id='b6281b6fe88fa4c313e6',\n        client_secret='21ff23d9f1cad775daee6a38d230e1ee05b04f7c',\n    )\n\n    authorize_url = github.get_authorize_url(scope=\"user:email\")\n\n    # ...\n    # Reload client to authorize_url and get code\n    # ...\n\n    otoken, _ = await github.get_access_token(code)\n\n    # Save the token for later use\n\n    # ...\n\n    github = GithubClient(\n        client_id='b6281b6fe88fa4c313e6',\n        client_secret='21ff23d9f1cad775daee6a38d230e1ee05b04f7c',\n        access_token=otoken,\n    )\n\n    # Or you can use this if you have initilized client already\n    # github.access_token = otoken\n\n    response = await github.request('GET', 'user')\n    user_info = await response.json()\n\n\n.. code:: python\n\n    # OAuth1\n    from aioauth_client import TwitterClient\n\n    twitter = TwitterClient(\n        consumer_key='J8MoJG4bQ9gcmGh8H7XhMg',\n        consumer_secret='7WAscbSy65GmiVOvMU5EBYn5z80fhQkcFWSLMJJu4',\n    )\n\n    request_token, _ = await twitter.get_request_token()\n\n    authorize_url = twitter.get_authorize_url(request_token)\n    print(\"Open\",authorize_url,\"in a browser\")\n    # ...\n    # Reload client to authorize_url and get oauth_verifier\n    # ...\n    print(\"PIN code:\")\n    oauth_verifier = input()\n    oauth_token, data = await twitter.get_access_token(oauth_verifier)\n    oauth_token_secret = data.get('oauth_token_secret')\n\n    # Save the tokens for later use\n\n    # ...\n\n    twitter = TwitterClient(\n        consumer_key='J8MoJG4bQ9gcmGh8H7XhMg',\n        consumer_secret='7WAscbSy65GmiVOvMU5EBYn5z80fhQkcFWSLMJJu4',\n        oauth_token=oauth_token,\n        oauth_token_secret=oauth_token_secret,\n    )\n\n    # Or you can use this if you have initilized client already\n    # twitter.access_token = oauth_token\n    # twitter.access_token_secret = oauth_token_secret\n\n    timeline = await twitter.request('GET', 'statuses/home_timeline.json')\n    content = await timeline.read()\n    print(content)\n\n\nExample\n-------\n\nRun example with command: ::\n\n    make example\n\nOpen http://localhost:8080 in your browser.\n\n.. _bugtracker:\n\nBug tracker\n===========\n\nIf you have any suggestions, bug reports or\nannoyances please report them to the issue tracker\nat https://github.com/klen/aioauth-client/issues\n\n.. _contributing:\n\nContributing\n============\n\nDevelopment of AIOAuth Client happens at: https://github.com/klen/aioauth-client\n\n.. _license:\n\nLicense\n========\n\nLicensed under a `MIT license`_.\n\n.. _links:\n\n.. _klen: https://github.com/klen\n.. _Asyncio: https://docs.python.org/3/library/asyncio.html\n.. _Trio: https://trio.readthedocs.io/en/stable/\n\n.. _MIT license: http://opensource.org/licenses/MIT\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "OAuth support for Asyncio/Trio libraries",
    "version": "0.28.1",
    "split_keywords": [
        "asyncio",
        "trio",
        "oauth"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6c990c946aec7e389b50e0a8b1b64aca002ff818e6b56c7ca92135f0bf1e164e",
                "md5": "81f51655b37137744542bb8025f86c73",
                "sha256": "13b30d8bb63566ebfcd609a0c3988a688a41a2ebdb98cd68b7e100c97d762cd0"
            },
            "downloads": -1,
            "filename": "aioauth_client-0.28.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "81f51655b37137744542bb8025f86c73",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 11986,
            "upload_time": "2023-03-16T19:37:47",
            "upload_time_iso_8601": "2023-03-16T19:37:47.453103Z",
            "url": "https://files.pythonhosted.org/packages/6c/99/0c946aec7e389b50e0a8b1b64aca002ff818e6b56c7ca92135f0bf1e164e/aioauth_client-0.28.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "259194faf3ce9269861a8b3d009dc65755b8011f4822d2ef790499223619e24c",
                "md5": "e930e6e530a85265fce050df54b39358",
                "sha256": "536f438cae7b7c3fbafddb3880c35aad5e5e52ab62205b0a0ed2a1dfbe80923b"
            },
            "downloads": -1,
            "filename": "aioauth_client-0.28.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e930e6e530a85265fce050df54b39358",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 12656,
            "upload_time": "2023-03-16T19:37:49",
            "upload_time_iso_8601": "2023-03-16T19:37:49.175243Z",
            "url": "https://files.pythonhosted.org/packages/25/91/94faf3ce9269861a8b3d009dc65755b8011f4822d2ef790499223619e24c/aioauth_client-0.28.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-16 19:37:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "klen",
    "github_project": "aioauth-client",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "aioauth-client"
}
        
Elapsed time: 0.04595s