Skip to main content

Url parsing and editing as an object or in a functional style.

>>> from urledit import urledit
>>> url = 'forum/showthread.php?s=12345&p=728386#post728386'

Functional style

>>> urledit(url)(scheme='http')(netloc='host.com')(fragment=''
... ).param(s=None).param(a=1).param(b=['x', 'y', 'z']).join()
'http://host.com/forum/showthread.php?p=728386&a=1&b=x&b=y&b=z'

or

>>> urledit(url, scheme='http', netloc='host.com', fragment=''
... ).param(('s', None), ('a', 1), b=['x', 'y', 'z']).join()
'http://host.com/forum/showthread.php?p=728386&a=1&b=x&b=y&b=z'

Object style

>>> u = urledit(url)
>>> u.scheme, u.netloc, u.path, u.qs, u.fragment
('', '', 'forum/showthread.php', 's=12345&p=728386', 'post728386')
>>> u.scheme, u.netloc, u.fragment = 'http', 'host.com', ''
>>> u.join()
'http://host.com/forum/showthread.php?s=12345&p=728386'

Working with query string:

>>> u.query == {'p': '728386', 's': '12345'}
True
>>> del u.query['s']
>>> u.join()
'http://host.com/forum/showthread.php?p=728386'
>>> u.query['a'] = 1
>>> u.query['b'] = ['x', 'y', 'z']
>>> u.join()
'http://host.com/forum/showthread.php?p=728386&a=1&b=x&b=y&b=z'

Release files for urledit 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for urledit 1.1.0
File Size Uploaded
urledit-1.1.0.tar.gz 2.4 kB Details

Release files / urledit-1.1.0.tar.gz

Download URL urledit-1.1.0.tar.gz
Size 2.4 kB
Tags Source
SHA-256 checksum
How to use checksums
167bec15e2449fca0047d60d40a90451bdbc1f011518723018821cb8b27bb277
BLAKE2b-256 checksum
How to use checksums
0ec1311afe00d7278691dec613a83bec53bbd9929e8630488e6d503cabed71c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.1.0 This release

1 release file

1.0.1

1 release file

1.0

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page