/uurl

ℹ️ User friendly URL python client (python + pytest + travisCI)

Primary LanguagePythonMIT LicenseMIT

Screenshot

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

uURL

Provides user-friendly unified resource locator (URL) client with nothing but clean objects.

Tools

Production

  • python 3.6, 3.7, 3.8

Development

Usage

To obtain the latest package from PYPI, please run the following script:

pip install uurl
✨ 🍰 ✨

Quick start

Pre-defined URL

>>> from uurl import Host, HttpsUrl, UrlPath
>>> url = HttpsUrl(Host('example.com'), UrlPath('shelter', 'index.html'))
>>> url.matcher()
'shelter/index.html'
>>> url.host()
'example.com'
>>> url.host(with_port=True)
'example.com:443'
>>> str(url)
'https://example.com:443/shelter/index.html'

Custom URL

>>> from uurl import Host, NetworkProtocol, NetworkPort, Url, UrlPath
>>> url = Url(
...    Host('0.0.0.0'),
...    NetworkProtocol('http', NetworkPort(8080, has_upd=True, has_tcp=True)),
...    UrlPath('api', 'rest', '1001')
... )
>>> url.matcher()
'api/rest/1001'
>>> url.host()
'0.0.0.0'
>>> url.host(with_port=True)
'0.0.0.0:8080'
>>> str(url)
'http://0.0.0.0:8080/api/rest/1001'

Development notes

Testing

Generally, pytest tool is used to organize testing procedure.

Please follow next command to run unittests:

pytest

CI

Project 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.sh

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 more details.

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