Name | stollen JSON |
Version |
0.6.9
JSON |
| download |
home_page | None |
Summary | An asynchronous framework to easily build a client-side API |
upload_time | 2025-08-13 20:48:44 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | None |
keywords |
api
asyncio
client
framework
wrapper
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
#######
stollen
#######
.. image:: https://img.shields.io/pypi/l/stollen.svg?style=flat-square
:target: https://opensource.org/licenses/MIT
:alt: MIT License
.. image:: https://img.shields.io/pypi/status/stollen.svg?style=flat-square
:target: https://pypi.python.org/pypi/stollen
:alt: PyPi status
.. image:: https://img.shields.io/pypi/v/stollen.svg?style=flat-square
:target: https://pypi.python.org/pypi/stollen
:alt: PyPi Package Version
.. image:: https://img.shields.io/pypi/dm/stollen.svg?style=flat-square
:target: https://pypistats.org/packages/stollen
:alt: Downloads
.. image:: https://img.shields.io/pypi/pyversions/stollen.svg?style=flat-square
:target: https://pypi.python.org/pypi/stollen
:alt: Supported python versions
**Stollen** is an asynchronous framework designed to streamline the process
of building API clients, written in Python 3.9+ using
`aiohttp <https://github.com/aio-libs/aiohttp>`_ and
`pydantic <https://docs.pydantic.dev/latest/>`_.
With a declarative approach, Stollen allows developers
to define API methods, handle responses, and manage errors
in a structured way, focusing on clarity and scalability.
Installation
------------
.. code-block:: bash
pip install -U stollen
Example
-------
.. code-block:: python
from __future__ import annotations
import asyncio
import logging
from stollen import Stollen, StollenMethod, StollenObject
from stollen.enums import HTTPMethod
from stollen.exceptions import StollenAPIError
class CoingeckoAPIError(StollenAPIError):
pass
class RateLimitError(CoingeckoAPIError):
pass
class Coingecko(Stollen):
def __init__(self) -> None:
super().__init__(
base_url="https://api.coingecko.com/api/v3",
error_message_key=["status", "error_message"],
general_error_class=CoingeckoAPIError,
error_codes={429: RateLimitError},
stringify_detailed_errors=False,
)
async def ping(self) -> GeckoSays:
call: Ping = Ping()
return await self(call)
class GeckoSays(StollenObject[Coingecko]):
gecko_says: str
class Ping(
StollenMethod[GeckoSays, Coingecko],
http_method=HTTPMethod.GET,
api_method="/ping",
returning=GeckoSays,
):
pass
async def main() -> None:
logging.basicConfig(level=logging.DEBUG)
async with Coingecko() as coingecko:
gecko_says: GeckoSays = await coingecko.ping()
logging.info(gecko_says)
if __name__ == "__main__":
asyncio.run(main())
Raw data
{
"_id": null,
"home_page": null,
"name": "stollen",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "wakaree <nullmatawasoradesu@gmail.com>",
"keywords": "api, asyncio, client, framework, wrapper",
"author": null,
"author_email": "wakaree <nullmatawasoradesu@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/dc/2b/11adbc3e8e06af0f4ee92075e525d474e30034b2e3b3ab9308fb3b6067c8/stollen-0.6.9.tar.gz",
"platform": null,
"description": "\n#######\nstollen\n#######\n\n.. image:: https://img.shields.io/pypi/l/stollen.svg?style=flat-square\n :target: https://opensource.org/licenses/MIT\n :alt: MIT License\n\n.. image:: https://img.shields.io/pypi/status/stollen.svg?style=flat-square\n :target: https://pypi.python.org/pypi/stollen\n :alt: PyPi status\n\n.. image:: https://img.shields.io/pypi/v/stollen.svg?style=flat-square\n :target: https://pypi.python.org/pypi/stollen\n :alt: PyPi Package Version\n\n.. image:: https://img.shields.io/pypi/dm/stollen.svg?style=flat-square\n :target: https://pypistats.org/packages/stollen\n :alt: Downloads\n\n.. image:: https://img.shields.io/pypi/pyversions/stollen.svg?style=flat-square\n :target: https://pypi.python.org/pypi/stollen\n :alt: Supported python versions\n\n**Stollen** is an asynchronous framework designed to streamline the process\nof building API clients, written in Python 3.9+ using\n`aiohttp <https://github.com/aio-libs/aiohttp>`_ and\n`pydantic <https://docs.pydantic.dev/latest/>`_.\nWith a declarative approach, Stollen allows developers\nto define API methods, handle responses, and manage errors\nin a structured way, focusing on clarity and scalability.\n\nInstallation\n------------\n\n.. code-block:: bash\n\n pip install -U stollen\n\nExample\n-------\n\n.. code-block:: python\n\n from __future__ import annotations\n\n import asyncio\n import logging\n\n from stollen import Stollen, StollenMethod, StollenObject\n from stollen.enums import HTTPMethod\n from stollen.exceptions import StollenAPIError\n\n\n class CoingeckoAPIError(StollenAPIError):\n pass\n\n\n class RateLimitError(CoingeckoAPIError):\n pass\n\n\n class Coingecko(Stollen):\n def __init__(self) -> None:\n super().__init__(\n base_url=\"https://api.coingecko.com/api/v3\",\n error_message_key=[\"status\", \"error_message\"],\n general_error_class=CoingeckoAPIError,\n error_codes={429: RateLimitError},\n stringify_detailed_errors=False,\n )\n\n async def ping(self) -> GeckoSays:\n call: Ping = Ping()\n return await self(call)\n\n\n class GeckoSays(StollenObject[Coingecko]):\n gecko_says: str\n\n\n class Ping(\n StollenMethod[GeckoSays, Coingecko],\n http_method=HTTPMethod.GET,\n api_method=\"/ping\",\n returning=GeckoSays,\n ):\n pass\n\n\n async def main() -> None:\n logging.basicConfig(level=logging.DEBUG)\n async with Coingecko() as coingecko:\n gecko_says: GeckoSays = await coingecko.ping()\n logging.info(gecko_says)\n\n\n if __name__ == \"__main__\":\n asyncio.run(main())\n",
"bugtrack_url": null,
"license": null,
"summary": "An asynchronous framework to easily build a client-side API",
"version": "0.6.9",
"project_urls": {
"Issues": "https://github.com/py-stollen/stollen/issues",
"Source": "https://github.com/py-stollen/stollen"
},
"split_keywords": [
"api",
" asyncio",
" client",
" framework",
" wrapper"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "15d028c835038b34e6b3166424892f133225e6950b3a272537e0a6a548f5448c",
"md5": "b6113e18659db16164a809a87ee7ef3d",
"sha256": "f8e97397b2c0780ddc3c0dc630c613fa4b8eb5dc609472308d43301960452e3a"
},
"downloads": -1,
"filename": "stollen-0.6.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b6113e18659db16164a809a87ee7ef3d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 21189,
"upload_time": "2025-08-13T20:48:43",
"upload_time_iso_8601": "2025-08-13T20:48:43.595982Z",
"url": "https://files.pythonhosted.org/packages/15/d0/28c835038b34e6b3166424892f133225e6950b3a272537e0a6a548f5448c/stollen-0.6.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "dc2b11adbc3e8e06af0f4ee92075e525d474e30034b2e3b3ab9308fb3b6067c8",
"md5": "3e4a0779530a0d74e480dc781d2ae24d",
"sha256": "e6c71bd36c8f981f81ebce1eaaed697884708714f321c216719b946859a07219"
},
"downloads": -1,
"filename": "stollen-0.6.9.tar.gz",
"has_sig": false,
"md5_digest": "3e4a0779530a0d74e480dc781d2ae24d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 16508,
"upload_time": "2025-08-13T20:48:44",
"upload_time_iso_8601": "2025-08-13T20:48:44.877025Z",
"url": "https://files.pythonhosted.org/packages/dc/2b/11adbc3e8e06af0f4ee92075e525d474e30034b2e3b3ab9308fb3b6067c8/stollen-0.6.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-13 20:48:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "py-stollen",
"github_project": "stollen",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "stollen"
}