Skip to main content

A tool to easily create complicated and dynamic URLs and headers.

Install

pip install http-prep

import httpprep


URL = httpprep.URL(
    protocol="https",
    subdomain="www",
    domain="httpbin",
    top_level_domain="org",
    path_segments=["post"]
)
URL.components.queries["a", "b", "b" "c", "c"] = [1, 2, ..., 4, 5]
print(URL.build(query_check=...)) # any queries whose value is equal to ... will not be included
>>> 'https://www.httpbin.org/post?a=1&b=2&c=4'


HEADERS = httpprep.Headers()
HEADERS.Accept = "*/*"
HEADERS.Authorization = "abc123"
HEADERS.Content_Disposition = ...
HEADERS["Some-Non-Standard-Header"] = 1234
print(HEADERS.format_dict(...)) # any headers whose value is equal to ... will not be included
>>> {'Accept': '*/*', 'Authorization': 'abc123', 'Some-Non-Standard-Header': 1234}
print(HEADERS.format_list(...)) # any headers whose value is equal to ... will not be included
>>> [('Accept', '*/*'), ('Authorization', 'abc123'), ('Some-Non-Standard-Header', 1234)]
print(HEADERS.format_lines(...)) # any headers whose value is equal to ... will not be included
>>> ['Accept: */*', 'Authorization: abc123', 'Some-Non-Standard-Header: 1234']

Metadata

Release files for http-prep 0.0.6

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

Source distribution (sdist)

Source distribution for http-prep 0.0.6
File Size Uploaded Provenance Actions
http-prep-0.0.6.tar.gz 8.5 kB Without provenance Details for http-prep-0.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for http-prep 0.0.6
File Interpreter ABI Platform Actions
http_prep-0.0.6-py3-none-any.whl Python 3 none any Details for http_prep-0.0.6-py3-none-any.whl

Total release size: 17.9 kB

Release files / http-prep-0.0.6.tar.gz

Download URL http-prep-0.0.6.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6c50c01a1d1a0365562668bf42913139510ad1c029e13db53bea00657294b9c3
BLAKE2b-256 checksum
How to use checksums
fa8719c55e2aecf420389c6b93dcce5df89c62bfd2edb7b1facfe6206b79c106
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.1

Release files / http_prep-0.0.6-py3-none-any.whl

Download URL http_prep-0.0.6-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e1140beefea5c4071ba5e79da19f7e0bd7ca63cb7e1c5becd463974e3547e177
BLAKE2b-256 checksum
How to use checksums
ba3a0abb6a4f06e5d1ab98f3bc7e14d5eca05a5f2c2ce907be46afcb88ce2d1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.1

Security for http-prep 0.0.6

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.0.6 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