urequest

🌐 User friendly HTTP python client (requests + pytest + travisCI)

View project on GitHub

Screenshot

made-with-python Build Status Coverage Status Code style: black Checked with pylint Checked with flake8 Checked with pydocstyle Checked with mypy License EO principles respected here PyPI version shields.io PyPI pyversions PyPi downloads Downloads CodeFactor

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

Development

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.'

⬆ back to top

Development notes

CI

Please move analyse-source-code.sh script into .git/hooks/pre-commit file 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:

Contributing

I would highly appreciate any contribution and support. If you are interested to add your ideas into project please follow next simple steps:

  1. Clone the repository
  2. Configure git for the first time after cloning with your name and email
  3. pip install -r requirements.txt to install all project dependencies
  4. pip install -r requirements-dev.txt to install all development project dependencies
  5. Create your feature branch (git checkout -b feature/fooBar)
  6. Commit your changes (git commit -am 'Add some fooBar')
  7. Push to the branch (git push origin feature/fooBar)
  8. 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.

⬆ back to top