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.0.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

xurls-1.2.0-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xurls-1.2.0.tar.gz
  • Upload date:
  • Size: 19.1 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.0.tar.gz
Algorithm Hash digest
SHA256 2394e8008e4117d0649ef33758953679dee6e4d682b76b7074f738c6d8884f06
MD5 37824ba989cd47436127c7fae84900a7
BLAKE2b-256 527389b29df170b67b563db9eb9e7c25a994fc3a996976bc5c18440f34eaf3b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xurls-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.4 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e611c4c3c133f738f0178ea6a63aaa5203457ea91ddc522a8177474470e9639a
MD5 16530a5fefa50bc25f684c426fe9d87f
BLAKE2b-256 52bb6a3a82db8b60703bbb37c241bc1d04596e2be59b105615531c13e41aedf8

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