
uRequest
Provides user-friendly micro HTTP client with nothing but clean objects. Inspired by Elegant Object (EO) - https://www.elegantobjects.org.
Basically, it is a wrapper over requests python library. For asynchronous version please check aiorequest package.
Tools
Production
- python 3.6, 3.7, 3.8
- requests library
Development
- travis CI
- pytest framework
- black code formatter
- mypy static tyler
- pylint code style
- flake8 code formatter
- bats framework
Usage
Installation
Please run following script to obtain latest package from PYPI:
pip install urequest
β¨ π° β¨
Quick start
>>> from urequest.session import Session, HttpSession
>>> from urequest.response import Response
>>> from urequest.url import HttpUrl
>>>
>>> session: Session
>>> with HttpSession() as session:
... response: Response = session.get(
... HttpUrl(host="xkcd.com", path="info.0.json")
... )
... response.status()
... response.as_json()
...
<HTTPStatus.OK: 200>
{
"month": "3",
"num": 2284,
"link": "",
"year": "2020",
"news": "",
"safe_title": "Sabotage",
"transcript": "",
"alt": "So excited to see everyone after my cruise home from the World Handshake Championships!",
"img": "https://imgs.xkcd.com/comics/sabotage.png",
"title": "Sabotage",
"day": "23",
}
Source code
git clone git@github.com:vyahello/urequest.git
python setup.py install
Or using specific release:
pip install git+https://github.com/vyahello/urequest@0.0.4
Local debug
git clone git@github.com:aiopymake/aiorequest.git
>>> import urequest
>>> urequest.__doc__
'Provides user-friendly HTTP client with clean objects.'
Development notes
CI
Please move
analyse-source-code.shscript into.git/hooks/pre-commitfile to be able to check your code on every next commit.mv analyse-source-code.sh .git/hooks/pre-commit
Project has Travis CI integration using .travis.yml file thus code analysis (black, pylint, flake8, mypy, pydocstyle) 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.sh
In addition, a project uses bats framework to test package workability.
Please run the following command to launch package tests:
bats test-package.bats
Release notes
Please check changelog file to get more details about actual versions and itβs release notes.
Meta
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
Contributing
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
Whatβs next
All recent activities and ideas are described at project issues. If you have ideas you want to change/implement please do not hesitate and create an issue.