aioauth-client


Nameaioauth-client JSON
Version 0.29.0 PyPI version JSON
download
home_pagehttps://github.com/klen/aioauth-client
SummaryOAuth support for Asyncio/Trio libraries
upload_time2024-11-14 14:15:09
maintainerNone
docs_urlNone
authorKirill Klenov
requires_python<4.0,>=3.9
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.9

.. _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": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "asyncio, trio, oauth",
    "author": "Kirill Klenov",
    "author_email": "horneds@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/3b/b4/b68d22fd122149d54a1f6d0d8ceec9edad3b94e4e7506af4fef46ca00367/aioauth_client-0.29.0.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.9\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.29.0",
    "project_urls": {
        "Homepage": "https://github.com/klen/aioauth-client",
        "Repository": "https://github.com/klen/aioauth-client"
    },
    "split_keywords": [
        "asyncio",
        " trio",
        " oauth"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9cad1c8c313627c89971fcdf3dccd5beb8b709daf21edf1033f3f4e0923af8a2",
                "md5": "bde198f41bc55464f7a9f037e862a4b7",
                "sha256": "94c62ea5172c9b7d2e7a921e313c75b1bb1b9c3ea76482d6a4d37e8a22182f71"
            },
            "downloads": -1,
            "filename": "aioauth_client-0.29.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bde198f41bc55464f7a9f037e862a4b7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 12165,
            "upload_time": "2024-11-14T14:15:08",
            "upload_time_iso_8601": "2024-11-14T14:15:08.235638Z",
            "url": "https://files.pythonhosted.org/packages/9c/ad/1c8c313627c89971fcdf3dccd5beb8b709daf21edf1033f3f4e0923af8a2/aioauth_client-0.29.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3bb4b68d22fd122149d54a1f6d0d8ceec9edad3b94e4e7506af4fef46ca00367",
                "md5": "fe3e19de983e745e060f3e3a41a162df",
                "sha256": "4d95f04bd487351ba812bfb016bb7d335a5067d38441516415aaa5302a0c9b49"
            },
            "downloads": -1,
            "filename": "aioauth_client-0.29.0.tar.gz",
            "has_sig": false,
            "md5_digest": "fe3e19de983e745e060f3e3a41a162df",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 12880,
            "upload_time": "2024-11-14T14:15:09",
            "upload_time_iso_8601": "2024-11-14T14:15:09.323074Z",
            "url": "https://files.pythonhosted.org/packages/3b/b4/b68d22fd122149d54a1f6d0d8ceec9edad3b94e4e7506af4fef46ca00367/aioauth_client-0.29.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-14 14:15:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "klen",
    "github_project": "aioauth-client",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "aioauth-client"
}
        
Elapsed time: 0.37846s