muffin-apiclient


Namemuffin-apiclient JSON
Version 3.8.1 PyPI version JSON
download
home_pagehttps://github.com/klen/muffin-apiclient
SummaryIt's a plugin for Muffin framework which provides support for external APIs
upload_time2024-07-31 22:13:34
maintainerNone
docs_urlNone
authorKirill Klenov
requires_python<4.0,>=3.9
licenseMIT
keywords apiclient muffin asyncio trio curio
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Muffin-APIClient
#################

.. _description:

**Muffin-APIClient** -- Its a plugin for Muffin_ framework which provides support
for external APIs

.. _badges:

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

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

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

.. _contents:

.. contents::

.. _requirements:

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

- python >= 3.9

.. _installation:

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

**Muffin-APIClient** should be installed using pip: ::

    pip install muffin-apiclient

.. _usage:

Usage
=====


Initialize and setup the plugin:

.. code-block:: python

    import muffin
    import muffin_apiclient

    # Create Muffin Application
    app = muffin.Application('example')

    # Initialize the plugin
    # As alternative: apiclient = muffin_apiclient.Plugin(app, **options)
    apiclient = muffin_apiclient.Plugin()
    apiclient.setup(app, root_url='https://api.github.com')

Github API (https://developer.github.com/v4/):

.. code:: python

    github = muffin_apiclient.Plugin(app, name='github', root_url='https://api.github.com', defaults={
        'headers': {
            'Authorization': 'token OAUTH-TOKEN'
        }
    })

    # Read information about the current repository
    repo = await github.api.repos.klen['muffin-apiclient'].get()
    print(repo)  # dict parsed from Github Response JSON


Slack API (https://api.slack.com/web):

.. code:: python

    slack = muffin_apiclient.Plugin(app, name='slack', root_url='https://slack.com/api', defaults={
        'headers': {
            'Authorization': 'token OAUTH-TOKEN'
        }
    })

    # Update current user status (we don't care about this response)
    await client.api['users.profile.set'].post(json={
        'profile': {
            'status_text': 'working',
            'status_emoji': ':computer:'
            'status_expiration': 30,
        }
    }, read_response_body=False)


And etc

Options
-------

=========================== =========================== ===========================
Name                        Default value               Desctiption
--------------------------- --------------------------- ---------------------------
**root_url**                ``None``                    Define general root URL for the client
**timeout**                 ``None``                    Define client timeout
**backend_type**            ``httpx``                   APIClient backend (httpx|aiohttp)
**backend_options**         ``{}``                      Backend options
**raise_for_status**        ``True``                    Raise errors for HTTP statuses (300+)
**read_response_body**      ``True``                    Read responses
**parse_response_body**     ``True``                    Parse responses (load json, etc)
**client_defaults**         ``{}``                      Default client values (headers, auth, etc)
=========================== =========================== ===========================


You are able to provide the options when you are initiliazing the plugin:

.. code-block:: python

    apiclient.setup(app, root_url='https://api.github.com')


Or setup it inside ``Muffin.Application`` config using the ``APICLIENT_`` prefix:

.. code-block:: python

   APICLIENT_ROOT_URL = 'https://api.github.com'

``Muffin.Application`` configuration options are case insensitive





.. _bugtracker:

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

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

.. _contributing:

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

Development of Muffin-APIClient happens at: https://github.com/klen/muffin-apiclient


Contributors
=============

* klen_ (Kirill Klenov)

.. _license:

License
========

Licensed under a `MIT license`_.

.. _links:


.. _klen: https://github.com/klen
.. _Muffin: https://github.com/klen/muffin

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/klen/muffin-apiclient",
    "name": "muffin-apiclient",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "apiclient, muffin, asyncio, trio, curio",
    "author": "Kirill Klenov",
    "author_email": "horneds@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/62/25/f1c7ffb8f0893b1e677b1445003b3c86370a74f4123123259f8cc95e45db/muffin_apiclient-3.8.1.tar.gz",
    "platform": null,
    "description": "Muffin-APIClient\n#################\n\n.. _description:\n\n**Muffin-APIClient** -- Its a plugin for Muffin_ framework which provides support\nfor external APIs\n\n.. _badges:\n\n.. image:: https://github.com/klen/muffin-apiclient/workflows/tests/badge.svg\n    :target: https://github.com/klen/muffin-apiclient/actions\n    :alt: Tests Status\n\n.. image:: https://img.shields.io/pypi/v/muffin-apiclient\n    :target: https://pypi.org/project/muffin-apiclient/\n    :alt: PYPI Version\n\n.. image:: https://img.shields.io/pypi/pyversions/muffin-apiclient\n    :target: https://pypi.org/project/muffin-apiclient/\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**Muffin-APIClient** should be installed using pip: ::\n\n    pip install muffin-apiclient\n\n.. _usage:\n\nUsage\n=====\n\n\nInitialize and setup the plugin:\n\n.. code-block:: python\n\n    import muffin\n    import muffin_apiclient\n\n    # Create Muffin Application\n    app = muffin.Application('example')\n\n    # Initialize the plugin\n    # As alternative: apiclient = muffin_apiclient.Plugin(app, **options)\n    apiclient = muffin_apiclient.Plugin()\n    apiclient.setup(app, root_url='https://api.github.com')\n\nGithub API (https://developer.github.com/v4/):\n\n.. code:: python\n\n    github = muffin_apiclient.Plugin(app, name='github', root_url='https://api.github.com', defaults={\n        'headers': {\n            'Authorization': 'token OAUTH-TOKEN'\n        }\n    })\n\n    # Read information about the current repository\n    repo = await github.api.repos.klen['muffin-apiclient'].get()\n    print(repo)  # dict parsed from Github Response JSON\n\n\nSlack API (https://api.slack.com/web):\n\n.. code:: python\n\n    slack = muffin_apiclient.Plugin(app, name='slack', root_url='https://slack.com/api', defaults={\n        'headers': {\n            'Authorization': 'token OAUTH-TOKEN'\n        }\n    })\n\n    # Update current user status (we don't care about this response)\n    await client.api['users.profile.set'].post(json={\n        'profile': {\n            'status_text': 'working',\n            'status_emoji': ':computer:'\n            'status_expiration': 30,\n        }\n    }, read_response_body=False)\n\n\nAnd etc\n\nOptions\n-------\n\n=========================== =========================== ===========================\nName                        Default value               Desctiption\n--------------------------- --------------------------- ---------------------------\n**root_url**                ``None``                    Define general root URL for the client\n**timeout**                 ``None``                    Define client timeout\n**backend_type**            ``httpx``                   APIClient backend (httpx|aiohttp)\n**backend_options**         ``{}``                      Backend options\n**raise_for_status**        ``True``                    Raise errors for HTTP statuses (300+)\n**read_response_body**      ``True``                    Read responses\n**parse_response_body**     ``True``                    Parse responses (load json, etc)\n**client_defaults**         ``{}``                      Default client values (headers, auth, etc)\n=========================== =========================== ===========================\n\n\nYou are able to provide the options when you are initiliazing the plugin:\n\n.. code-block:: python\n\n    apiclient.setup(app, root_url='https://api.github.com')\n\n\nOr setup it inside ``Muffin.Application`` config using the ``APICLIENT_`` prefix:\n\n.. code-block:: python\n\n   APICLIENT_ROOT_URL = 'https://api.github.com'\n\n``Muffin.Application`` configuration options are case insensitive\n\n\n\n\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/muffin-apiclient/issues\n\n.. _contributing:\n\nContributing\n============\n\nDevelopment of Muffin-APIClient happens at: https://github.com/klen/muffin-apiclient\n\n\nContributors\n=============\n\n* klen_ (Kirill Klenov)\n\n.. _license:\n\nLicense\n========\n\nLicensed under a `MIT license`_.\n\n.. _links:\n\n\n.. _klen: https://github.com/klen\n.. _Muffin: https://github.com/klen/muffin\n\n.. _MIT license: http://opensource.org/licenses/MIT\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "It's a plugin for Muffin framework which provides support for external APIs",
    "version": "3.8.1",
    "project_urls": {
        "Homepage": "https://github.com/klen/muffin-apiclient",
        "Repository": "https://github.com/klen/muffin-apiclient"
    },
    "split_keywords": [
        "apiclient",
        " muffin",
        " asyncio",
        " trio",
        " curio"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4e0763bdf754f1a6099f1cf76e82f7be04b2938a0f21df8c036d645c376f3d60",
                "md5": "7e71911112a1198f3f84d2fc5016ca02",
                "sha256": "e2f7651dd0bfad6b01d91a8a358ded362c462c630a680948c33c6b619d707777"
            },
            "downloads": -1,
            "filename": "muffin_apiclient-3.8.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7e71911112a1198f3f84d2fc5016ca02",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 4649,
            "upload_time": "2024-07-31T22:13:33",
            "upload_time_iso_8601": "2024-07-31T22:13:33.336902Z",
            "url": "https://files.pythonhosted.org/packages/4e/07/63bdf754f1a6099f1cf76e82f7be04b2938a0f21df8c036d645c376f3d60/muffin_apiclient-3.8.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6225f1c7ffb8f0893b1e677b1445003b3c86370a74f4123123259f8cc95e45db",
                "md5": "35097f825f9342fd2936ebf4a832c7d5",
                "sha256": "c7eafaa16c47bf1c372a53ab7abdd04514f931d08234aa765d703a93b12ac846"
            },
            "downloads": -1,
            "filename": "muffin_apiclient-3.8.1.tar.gz",
            "has_sig": false,
            "md5_digest": "35097f825f9342fd2936ebf4a832c7d5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 4339,
            "upload_time": "2024-07-31T22:13:34",
            "upload_time_iso_8601": "2024-07-31T22:13:34.740024Z",
            "url": "https://files.pythonhosted.org/packages/62/25/f1c7ffb8f0893b1e677b1445003b3c86370a74f4123123259f8cc95e45db/muffin_apiclient-3.8.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-31 22:13:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "klen",
    "github_project": "muffin-apiclient",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "muffin-apiclient"
}
        
Elapsed time: 0.33311s