Skip to main content

Url parsing and editing

Project description

>>> from urledit import Url

URL parsing and editing:

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

Working with query string:

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

urledit-0.1.tar.gz (2.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page