Skip to main content
# PyURI

[![Build Status](https://travis-ci.org/nick-allen/pyuri.svg?branch=master)](https://travis-ci.org/nick-allen/pyuri)
[![Coverage Status](https://coveralls.io/repos/github/nick-allen/pyuri/badge.svg?branch=master)](https://coveralls.io/github/nick-allen/pyuri?branch=master)
[![PyPI version](https://badge.fury.io/py/pyuri.svg)](https://badge.fury.io/py/pyuri)

Better URI handling

Tested with Python 2.7 and 3.6

---

## Install

`pip install pyuri`

## Usage

Raw URI string parsing:

```python
from pyuri import URI

uri = URI('http://localhost:80/path/to/file?query=value#/fragment/path')

assert uri.scheme == 'http'
assert uri.host == 'localhost'
assert uri.port == 80
assert uri.path == '/path/to/file'
assert uri.query == 'query=value'
assert uri.fragment == '/fragment/path'
```

Composition by parts

```python
from pyuri import URI

uri = URI(scheme='ftp', host='localhost', port=8000, query='key=value')

assert str(uri) == 'ftp://localhost:8000?key=value'
```

Modification and comparison

```python
from pyuri import URI

uri1 = URI('https://example.com:80')
uri2 = URI('https://example.com:443/new/path')

assert uri1 != uri2

uri1.port = 443
uri1.path = '/new/path'

assert str(uri1) == 'https://example.com:443/new/path'

assert uri1 == uri2
```

Additional helpers

```python
from pyuri import URI

uri = URI('http://localhost:80/path/to/file?repeat=value1&repeat=value2&escape=escaped%20value#/fragment/path')

# Access query parameters as dictionary
assert uri.query_dict() == {
'repeat': ['value1', 'value2'],
'escape': ['escaped value']
}
```

Metadata

Release files for pyuri 0.3.1

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

Source distribution (sdist)

Source distribution for pyuri 0.3.1
File Size Uploaded Provenance
pyuri-0.3.1.tar.gz 7.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyuri 0.3.1
File Interpreter ABI Platform
pyuri-0.3.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 13.3 kB

Release files / pyuri-0.3.1.tar.gz

Download URL pyuri-0.3.1.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
dc691e7a13aab7664eff1912760c3a53e2acc77f2e5bc4ef46560265ebab7430
BLAKE2b-256 checksum
How to use checksums
60d0d86b0a2588ca66e9b25bdfe6b8193600fb7f8cf7472cc79d689552d1a27f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pyuri-0.3.1-py2.py3-none-any.whl

Download URL pyuri-0.3.1-py2.py3-none-any.whl
Size 6.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
0db8582a7580fa675108dd48f16af0988ee2598a18e80df803ce06909bd842c6
BLAKE2b-256 checksum
How to use checksums
d796633b4e8e8cf5367eb702c3b07c8c6d352e7697f99a73e6aa00c85fb0e51e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pyuri 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files No provenance

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