miniuri is a universal URI parser class.
Only 150 lines of Python (486 lines if you count unit tests).
Installation
pip install miniuri
What does it do?
The parser grants access to the following attributes:
foo://username:password@test.com:808/go/to/index.php?pet=cat&name=bam#eye
\_/ \_______________/ \______/ \_/ \___/ \_/ \_______________/\_/
| | | | | | | |
| userinfo hostname | | | query fragment
| \___________________________|/\________|____|_/
| | | | | |
scheme authority | path | extension
| |
port filename
Tutorial
This example shows how you can set and get any of the URI attributes:
>>> from miniuri import Uri
>>> u = Uri( "http://www.foxhop.net/samsung/HL-T5087SA/red-LED-failure" )
>>> u.uri = "https://fox:pass@www.foxhop.net:81/path/filename.jpg?p=2#5"
>>> print(u.uri)
'https://fox:pass@www.foxhop.net:81/path/filename.jpg?p=2#5'
>>> print(u.hostname)
'www.foxhop.net'
>>> print(u.scheme)
'https'
>>> u.username = 'max'
>>> print(u)
'https://max:pass@www.foxhop.net:81/path/filename.jpg?p=2#5'
>>> print(u.relative_uri)
'/path/filename.jpg?p=2#5'
How do I thank you?
You should follow me on http://twitter.com/russellbal
License
Public Domain
Public Revision Control
Release files for miniuri 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| miniuri-1.2.0.tar.gz | 6.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| miniuri-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.7 kB
Release files / miniuri-1.2.0.tar.gz
| Download URL | miniuri-1.2.0.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d93b4996fa8f46e111f132ce082ed965b574d00135c010e69b8572245576b9b
|
|
BLAKE2b-256 checksum How to use checksums |
4d574141542143598169061e808f2d72eae945da9014310a60db877a3c46903d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / miniuri-1.2.0-py3-none-any.whl
| Download URL | miniuri-1.2.0-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13e2591608557b0008ffe026ae344c10c0eb50cc15430884f6d0294c44365a3c
|
|
BLAKE2b-256 checksum How to use checksums |
97cdcdca0d769f771eb3c6293d6cda04d57576f1dd872aceec2969af2be92181
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|