Name | stollen JSON |
Version |
0.2.13
JSON |
| download |
home_page | None |
Summary | An asynchronous framework to easily build a client-side API |
upload_time | 2024-10-28 16:11:22 |
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
#######
**stollen** is an asynchronous framework to easily build a client-side API.
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/93/5d/84641b779a912af69465acb6c840fcf9b7a0f785acfa5d6c83094732a2ce/stollen-0.2.13.tar.gz",
"platform": null,
"description": "\n#######\nstollen\n#######\n\n**stollen** is an asynchronous framework to easily build a client-side API.\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.2.13",
"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": "",
"digests": {
"blake2b_256": "4df700ea72295f83663e41effeb9e75c01e7d606984291b2103b739791eb09d6",
"md5": "b49fac30b4e16882459eb11963c90f3f",
"sha256": "e523226e65116e068b9b30be428b8d9ce9c1d811b4a1ff36a1fbada80d09f1ef"
},
"downloads": -1,
"filename": "stollen-0.2.13-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b49fac30b4e16882459eb11963c90f3f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 15315,
"upload_time": "2024-10-28T16:11:21",
"upload_time_iso_8601": "2024-10-28T16:11:21.064771Z",
"url": "https://files.pythonhosted.org/packages/4d/f7/00ea72295f83663e41effeb9e75c01e7d606984291b2103b739791eb09d6/stollen-0.2.13-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "935d84641b779a912af69465acb6c840fcf9b7a0f785acfa5d6c83094732a2ce",
"md5": "8bc199ad147bc7ce0580ae15344a50ab",
"sha256": "dff4eea16335be005b6eb5b39c93e043519df1430440cb8dcff391433344a507"
},
"downloads": -1,
"filename": "stollen-0.2.13.tar.gz",
"has_sig": false,
"md5_digest": "8bc199ad147bc7ce0580ae15344a50ab",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 13343,
"upload_time": "2024-10-28T16:11:22",
"upload_time_iso_8601": "2024-10-28T16:11:22.769439Z",
"url": "https://files.pythonhosted.org/packages/93/5d/84641b779a912af69465acb6c840fcf9b7a0f785acfa5d6c83094732a2ce/stollen-0.2.13.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-28 16:11:22",
"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"
}