Skip to main content

Python URL Library

Project description

PythonSupport PyPI version

Documentation

A high-level Url class to make parsing, looking at and manipulating urls much easier.

Also allows for easily composable urls.

Everything is subject to change!

📄 Detailed Documentation | 🐍 PyPi

Getting Started

poetry install xurls

or

pip install xurls

Very basic example:

from xurls import Url

url = Url("http://www.google.com/some/path?some_key=some-value")
assert url.host == "www.google.com"

url.host = "apple.com"
assert str(url) == "http://apple.com/some/path"

assert url['some_key'] == 'some-value'

You can also compose urls:

from xurls import Url

base_url = Url(host='www.example.com')
url_to_append = Url(path='hello/today')

# Append url; paths will append to end, queries merged together.
# Other components like host will be replaced if there is a value in the appended url.
final_url = base_url.copy().append_url(url_to_append)

assert str(final_url) == 'www.example.com/hello/today'

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

xurls-1.2.1.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

xurls-1.2.1-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file xurls-1.2.1.tar.gz.

File metadata

  • Download URL: xurls-1.2.1.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for xurls-1.2.1.tar.gz
Algorithm Hash digest
SHA256 d3dc99e992faa201c6a30a23573bd4667f51377bfcc07ec14d3b7ce877a31ef5
MD5 d0770cc68f319bb16389d8a11f9bcb7b
BLAKE2b-256 e607ace018a1f80291079afdb7aab32e44263382d374be33509981c7fba5de97

See more details on using hashes here.

File details

Details for the file xurls-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: xurls-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for xurls-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9fa01306d6e8ab09a6c2eaeb2499c396b577fd2f1f0529486b776911775b841e
MD5 49846cd2dab6a182206327019a8c5631
BLAKE2b-256 78672442772e30109cd732e04b2b5149a70622a0712ccddb6e9db0c2000c8b23

See more details on using hashes here.

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