ppURI
A pyparsing based URI parser/scanner library.
Install using pip or your tool of choice e.g.
pip install ppuri
poetry add ppuri
Usage
Parsing
Either import ppuri.uri and use the parse function to match and parse against all URI schemes e.g.
from ppuri import uri
info = uri.parse("https://www.example.com:443/a.path?q=aparam#afragment")
print(info)
prints
{
"authority": { "address": "www.example.com", "port": "443" },
"fragment": "afragment",
"parameters": [{ "name": "q", "value": "aparam" }],
"path": "/a.path",
"scheme": "https",
"uri": "https://www.example.com:443/a.path?q=aparam#afragment"
}
Or import a specific scheme's parse function.
from ppuri.scheme import http
info = http.parse()
and use that to parse
Scanning
To scan text for URIs use the scan method
Supported schemes
Currently supports the following schemes
- http(s)
- urn
- data
- file
- mailto
- about
- aaa
- coap
- crid
Http(s)
parse_string returns a dictionary of the form
{
"scheme": "http or https",
"authority": {
"address": "hostname or ipv4 address or ipv6 address",
"port": "port number",
"username": "user name if provided",
"password": "pasword if provided"
},
"path": "path if provided",
"parameters": [
// list of parameters if provided
{
"name": "parameter name",
"value": "parameter value or None if not provided"
}
],
"fragment": "fragment if provided",
"uri": "The full URI"
}
Urn
parse_string returns a dictionary of the form
{
"scheme": "urn",
"nid": "Namespace Identifier",
"nss": "Namespace Specific String",
"uri": "The full URI"
}
MailTo
parse_string returns a dictionary of the form
{
"scheme": "mailto",
"addresses": [
"List of email addresses",
]
"parameters": [
"list of parameters if provided",
{
"name": "bcc",
"value": "dave@example.com"
}
],
"uri": "The full URI"
}
Data
parse_string returns a dictionary of the form
{
"scheme": "data",
"type": "Mime type",
"subtype": "Mime Subtype",
"encoding": "base64 if specified",
"data": "The actual data",
"uri": "The full URI"
}
File
parse_string returns a dictionary of the form
{
"scheme": "file",
"path": "The /file/path",
"uri": "The full URI"
}
Package Status
Metadata
Release files for ppuri 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ppuri-0.3.1.tar.gz | 13.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ppuri-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.8 kB
Release files / ppuri-0.3.1.tar.gz
| Download URL | ppuri-0.3.1.tar.gz |
|---|---|
| Size | 13.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8879b61fb9b578144e32a247e4ddb4e296ce1559fa97b4b3d73ddb2bc3cc04bc
|
|
BLAKE2b-256 checksum How to use checksums |
4957922b063ff494cd4040f7f643203f20c4f56791879d8316c2de6b3266d891
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.15 CPython/3.10.5 Linux/5.10.102.1-microsoft-standard-WSL2
|
Release files / ppuri-0.3.1-py3-none-any.whl
| Download URL | ppuri-0.3.1-py3-none-any.whl |
|---|---|
| Size | 19.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4ab92fe53e9903176e55288fc26ebc261f2e98863fdaae7d3b58a23d67fa8851
|
|
BLAKE2b-256 checksum How to use checksums |
85d5e3a8c00a91e1ef2db4bdbfde61b51eb0815e03457cffbea963a9eab0b03b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.15 CPython/3.10.5 Linux/5.10.102.1-microsoft-standard-WSL2
|
Security for ppuri 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.