imurl is an immutable URL library, written in modern Python.
imurl is inspired by both purl and Python's pathlib
and datetime modules. It aims to provide a simple, immutable data structure to represent
URL structures, with support for a wide range of URL/URI schemes.
Examples
Here are some quick examples for imurl. There are more in the documentation..
URLs can be created from URL strings, and have the attributes you'd expect:
>>> from imurl import URL
>>> u = URL("https://example.com")
>>> u
imurl.URL('https://example.com')
>>> u.host
'example.com'
>>> u.scheme
'https'
URLs are immutable, but components can be replaced similarly to datetime/pathlib objects:
>>> u.replace(path="/some/path")
imurl.URL('https://example.com/some/path')
>>> u.path # This is still `None` - we haven't modified `u`.
>>> u.replace(path="/some/path").path_as_posix
PurePosixPath('/some/path')
URLs can also be built from components, and query/path parameters can be set/get/deleted:
>>> u = URL(scheme="https", host="google.com", path="/search")
imurl.URL('https://google.com/search')
>>> u2 = u.set_query("q", "a+search+term")
>>> u2
imurl.URL('https://google.com/search?q=a+search+term')
>>> u2.delete_query("q")
imurl.URL('https://google.com/search')
Installation
imurl can be installed with pip, and has been tested on Python 3.7. imurl is still
alpha software, and should be considered unstable:
pip install imurl
Metadata
Release files for imurl 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| imurl-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Release files / imurl-0.0.3-py3-none-any.whl
| Download URL | imurl-0.0.3-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d198702f92c8e8f993ddc58a88d3defa2599ce451af2afa0cf42c48b3ff9bded
|
|
BLAKE2b-256 checksum How to use checksums |
223f3d8cf991451afaee6c981eca0ce0a853bb2c1813fddd63c3fc141c54bca9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5
|