'URL parser and manipulator based on the WHAT WG URL standard'
Project description
This is ada_url, a Python library for parsing and joining URLs.
WHATWG URL compliance
Unlike the standard library’s urllib.parse module, this library is compliant with the WHATWG URL spec.
urlstring = "https://www.GOoglé.com/./path/../path2/"
import ada_url
# prints www.xn--googl-fsa.com,
# the correctly parsed domain name according to WHATWG
print(ada_url.URL(urlstring).hostname)
# prints /path2/
# the correctly parsed pathname according to WHATWG
print(ada_url.URL(urlstring).pathname)
import urllib
#prints www.googlé.com
print(urllib.parse.urlparse(urlstring).hostname)
#prints /./path/../path2/
print(urllib.parse.urlparse(urlstring).path)
Examples
This package exposes a URL class that is intended to match the one described in the WHATWG URL spec.
>>> import ada_url
>>> ada_url.URL('https://example.org/path/../file.txt') as urlobj:
>>> urlobj.host = 'example.com'
>>> new_url = urlobj.href
>>> new_url
'https://example.com/file.txt'
It also provides some higher level functions for parsing and manipulating URLs.
>>> import ada_url
>>> ada_url.check_url('https://example.org')
True
>>> ada_url.join_url(
'https://example.org/dir/child.txt', '../parent.txt'
)
'https://example.org/parent.txt'
>>> ada_url.normalize_url('https://example.org/dir/../parent.txt')
'https://example.org/parent.txt'
>>> ada_url.parse_url('https://user:pass@example.org:80/api?q=1#2')
{
'href': 'https://user:pass@example.org:80/api?q=1#2',
'username': 'user',
'password': 'pass',
'protocol': 'https:',
'host': 'example.org:80',
'port': '80',
'hostname': 'example.org',
'pathname': '/api',
'search': '?q=1',
'hash': '#2'
}
>>> ada_url.replace_url('http://example.org:80', protocol='https:')
'https://example.org/'
You can find more documentation at Read the Docs.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ada-url-1.0.1.tar.gz
(374.4 kB
view hashes)
Built Distributions
Close
Hashes for ada_url-1.0.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19822a5839c6f3e1f41233e2c7f6d3e163fb01945c3019a73f96b31ac4919202 |
|
MD5 | 850b276b0b657adf010bbe95bada4448 |
|
BLAKE2b-256 | 47066254373421f6601db1a9a3d27eb9afbc0e3937e14da22379463fbab64f84 |
Close
Hashes for ada_url-1.0.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5994cc7842c1b39bd0c3e5a79048c6a87b3a43d22e8bca73955b470dddd1c2f2 |
|
MD5 | 0a3cd23d6e53d786a9c0ee4955349d41 |
|
BLAKE2b-256 | 29f3952d8a02139d3fd05a45aa869638d07e7f7a3380ae190b85a6e578d25892 |
Close
Hashes for ada_url-1.0.1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1735d6e394a17af70ae1a5fe927a93952d931170b015ec8aa2516ea2293718e9 |
|
MD5 | c243ea1e4b150d2f0612fc4f0bb50bf1 |
|
BLAKE2b-256 | 77b7fd77c764a0b944a34515f0bb6e277ab57dcb8dff36fb955de26788676dd9 |
Close
Hashes for ada_url-1.0.1-pp38-pypy38_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e66b446202d9936c049f9c874358cc5fd65f8c6a75ad18c6709a35e46b72de6a |
|
MD5 | 7b43e39e3403817b2d7d356926470479 |
|
BLAKE2b-256 | 09d08500cde249b14b862b00f7d7dce281cbc0640b9a9c2d0178954ca577b257 |
Close
Hashes for ada_url-1.0.1-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aee60ea050e49afe3e861cb809f02168300aac97fd57c56de0074d141c4049ff |
|
MD5 | 2926f187299ac4fcd4d7af20c868ca9d |
|
BLAKE2b-256 | b2a6668a347944b58be528758be28d55f8f1f6b1f00041d6c1134257e70279eb |
Close
Hashes for ada_url-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bae2aca8392f2093b211f464e2814996a2426cb8646590274271550b35d567f9 |
|
MD5 | 6805c4043de72ceeaa7e38112a470942 |
|
BLAKE2b-256 | c89164a0f5237083c0cd8e52b09e487741d3ba1a0184cafac19505a9b0c2bb98 |
Close
Hashes for ada_url-1.0.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ea028e31e3a2ffcc9a2c346253e5b56851e0f717f5861c7fdd146a252641639 |
|
MD5 | 36862eb39fe35381d06049775c45da08 |
|
BLAKE2b-256 | 622426a023c84ef0374f9f454543ea3fc4e3f8661e642da8f634bb19fb939d08 |
Close
Hashes for ada_url-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bca17ba2d4dde15a3abbc6bc16c91e7eefcf2081054dcdea6cda6396cdd5a93 |
|
MD5 | d30e0b7af2d3ed06958c78891c3959f2 |
|
BLAKE2b-256 | 15f5cc9820e6da6ddd1777c55ee8dba880712f837fe563c1b71421304b20c181 |
Close
Hashes for ada_url-1.0.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4ea9babe6191a2051900ca66ad8ced593cfc66d94d255548a4421244b3af9af |
|
MD5 | 66ffc9fa2766cdca3fc1249906571d8d |
|
BLAKE2b-256 | 9628d4a51763382e534adc0d9c8a3b1f5537c51cff6fb307663fecd8bd99019a |
Close
Hashes for ada_url-1.0.1-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90f30883b494431566dda04ca427ad129e6b3335834de7894e7e259b394e282f |
|
MD5 | 173530645e04274931732eda1465ca0e |
|
BLAKE2b-256 | d6a7c6545cd6672dda1b5bbcf825dd14d8079906b317cfcca2f33eb2a3452750 |
Close
Hashes for ada_url-1.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c86516564fc2fca90741b1dcd6a18f1d6d88a8baed40476a6420b371bc2833ae |
|
MD5 | 1dd6c4267c14cd425efdcd897a8b547b |
|
BLAKE2b-256 | 1b6eb881428aaaac64d1bf3126c56294d4a76c26d4c23acb11ec72809cd4a4ee |
Close
Hashes for ada_url-1.0.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64ae429cead614c513d6fd3e96569afa84e3c200e725e138c323ee056ac9e13e |
|
MD5 | e19a375eeb174eef3ba269c2456b7109 |
|
BLAKE2b-256 | 6f635f9a4aae4cdc396e276830580e59b555c0d6f257585462000cd2cd9cf419 |
Close
Hashes for ada_url-1.0.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b85ae5b6f447c6e7e8a0e60ab868e0bc0d4b32f277c77575c8f7ca3f7679885 |
|
MD5 | 9635c8c84150f000eeb2bda0b466525d |
|
BLAKE2b-256 | 0f01a8984634e89f95ca9882013a4a4cc4610b8cec11abd25f71745c61aad71d |
Close
Hashes for ada_url-1.0.1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec61a3f948404993f50846996e93bb5001ed4234de9c94d523fd7e0d493e7ccb |
|
MD5 | 765ee3c1b70804b4c7be9727b4de28a1 |
|
BLAKE2b-256 | 676edb68a53886a6a5b4201f944924ce20d24650a647e51407be31debc749e2f |
Close
Hashes for ada_url-1.0.1-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49162c069f8751de1ef0c73ab9d03f9c663a73ab251f6826ff8549f608448357 |
|
MD5 | 4b1dcaaac27be1d8b0b0f9526f49d896 |
|
BLAKE2b-256 | f34d6956ce12723129727c156a17d8d96e17b391dfc9e8304401a3e07b9e7ceb |
Close
Hashes for ada_url-1.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6157f05837e6a1b93e170a6a6e6419765772aa5bc37c1e607bb505335ee564e3 |
|
MD5 | 17bb3ee97dc183db2f970fab16ebbb7a |
|
BLAKE2b-256 | 48f08f6f22801bfb05611ebf28507a4bbc9f675c64523eace0ccd72e451f628d |
Close
Hashes for ada_url-1.0.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa51e3751d27bb88f136364893830e0ed8f0c8b5f30a2ea94197e9e2bae31b96 |
|
MD5 | 4ab6f957539f8ed8f4ccd7ca0f326379 |
|
BLAKE2b-256 | 80d94cb83ea1f04538eed5185831dc0d0ff17b97fcb6cb20b0385890cd3060cb |
Close
Hashes for ada_url-1.0.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da83313487b1ceed67466f529d03b9fd3af22d049d21fe9b6d5e95c4c49aafb0 |
|
MD5 | 2ab802ae15c8ea4ffb69a6940c24f4f0 |
|
BLAKE2b-256 | a3a56d770a902ca013e7ed4bfa7f398747174a8b0c328161aa77c19cec9161ab |
Close
Hashes for ada_url-1.0.1-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebb895b2a8954997ce6b7eca6f2a6d0efdc76c746daf66efce3c2a608216b258 |
|
MD5 | 0c253281f74a7694239325722de5478a |
|
BLAKE2b-256 | a82798fd1a3b18804a9c04d80943afaea84e4918fa5b321bb11edb4fa2e6c114 |
Close
Hashes for ada_url-1.0.1-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 437e6edd3791a934dbf81bde4bc14f2531cc8041fcfe578492999eb177eddc03 |
|
MD5 | 49d685c7396636bb1dffd992c6ba9658 |
|
BLAKE2b-256 | 623ea0196fa79111290c48c6a2de68da7b97512b438c94eeb8f4af660f98941d |
Close
Hashes for ada_url-1.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b75a5e73bc35dc2ca900dd33f4d59b9e2af1c1ec38776f447f8fa4cfd00f6460 |
|
MD5 | 021b1aab0d97b5c8187205e6807ba731 |
|
BLAKE2b-256 | 8a7f819b2774bb597833ede87e035d924fd4e4fddbd7a94c996566599bd988be |
Close
Hashes for ada_url-1.0.1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbd513b32f0fa678be8b125a12194866842ed272f7edc6ac1b83584c1c3ceab4 |
|
MD5 | 765b69a1694f1fd2d247719e74f2015b |
|
BLAKE2b-256 | e28c6515904c242e7812c637438aa77b4b2d4c5a57007f3c3547e381223416a4 |
Close
Hashes for ada_url-1.0.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93a7f00d74d44bb853b3c03dd765ea8b756d8313c890a8221762b96b43882bce |
|
MD5 | 10ff7237ca5b4dba3b6105e8260fbe81 |
|
BLAKE2b-256 | 0af816f81a930b6ca5aa00ab5f4f6ef2ed0d9e26ac3cb37516fbd3ffb9ebe6bf |
Close
Hashes for ada_url-1.0.1-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fafadf3ff5152ae1d8e1a9bb62ca7d90f09aa7c71dbae92287de5725b7c7178 |
|
MD5 | 6182331f24cbaaef35a54052bcd498dd |
|
BLAKE2b-256 | 8ab2badf3d876e194fcd4bbc8f9f20e565d01650cf8d57a9877431622676f5d7 |