Provides asynchronous user-friendly micro HTTP client with nothing but clean objects.
Basically, it is a wrapper over requests python library with async/await approach. Represents asynchronous version of urequest package.
pip install aiorequest
β¨ π° β¨>>> import asyncio
>>> from typing import Tuple
>>> from aiorequest.sessions import Session, HttpSession
>>> from aiorequest.responses import HTTPStatus, Response, JsonType
>>> from aiorequest.urls import HttpUrl
>>>
>>>
>>> async def aioresponse() -> Tuple[HTTPStatus, JsonType]:
... session: Session
... async with HttpSession() as session:
... response: Response = await session.get(
... HttpUrl(host="xkcd.com", path="info.0.json")
... )
... return await response.status(), await response.as_json()
...
...
>>>
>>> asyncio.run(aioresponse())
(
<HTTPStatus.OK: 200>,
{
"month": "3",
"num": 2284,
"link": "",
"year": "2020",
"news": "",
"safe_title": "Sabotage",
"transcript": "",
"img": "https://imgs.xkcd.com/comics/sabotage.png",
"title": "Sabotage",
"day": "23",
}
)git clone git@github.com:aiopymake/aiorequest.git
python setup.py installOr using specific release:
pip install git+https://github.com/aiopymake/aiorequest@0.0.1git clone git@github.com:aiopymake/aiorequest.git>>> import aiorequest
>>> aiorequest.__doc__
'Package provides asynchronous user-friendly HTTP client with clean objects.'Generally, pytest tool is used to organize testing procedure.
Please follow next command to run unittests:
pytestProject has Travis CI integration using .travis.yml file thus code analysis (black, pylint, flake8, mypy, pydocstyle and interrogate) and unittests (pytest) will be run automatically after every made change to the repository.
To be able to run code analysis, please execute command below:
./analyse-source-code.shThe package is also covered with the installation unit tests based on bats framework. Please run the following command to launch package unit tests:
bats --pretty test-package.bats
PACKAGE_NAMEandPACKAGE_VERSIONenvironment variables should be specified prelimirary.
Please check changelog file to get more details about actual versions and it's release notes.
Author β Volodymyr Yahello. Please check AUTHORS file for all contributors.
Distributed under the MIT license. See LICENSE for more information.
You can reach out me at:
- vyahello@gmail.com
- https://twitter.com/vyahello
- https://www.linkedin.com/in/volodymyr-yahello-821746127
I would highly appreciate any contribution and support. If you are interested to add your ideas into project please follow next simple steps:
- Clone the repository
- Configure
gitfor the first time after cloning with yournameandemail pip install -r requirements.txtto install all project dependenciespip install -r requirements-dev.txtto install all development project dependencies- Create your feature branch (git checkout -b feature/fooBar)
- Commit your changes (git commit -am 'Add some fooBar')
- Push to the branch (git push origin feature/fooBar)
- Create a new Pull Request
All recent activities and ideas are described at project issues page. If you have ideas you want to change/implement please do not hesitate and create an issue.