Skip to main content

A tool to easily create complicated and dynamic URLs and headers

Project description

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']

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

http-prep-0.0.6.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

http_prep-0.0.6-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file http-prep-0.0.6.tar.gz.

File metadata

  • Download URL: http-prep-0.0.6.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.1

File hashes

Hashes for http-prep-0.0.6.tar.gz
Algorithm Hash digest
SHA256 6c50c01a1d1a0365562668bf42913139510ad1c029e13db53bea00657294b9c3
MD5 58647c73eb1a6ce4562aac1e97f65f93
BLAKE2b-256 fa8719c55e2aecf420389c6b93dcce5df89c62bfd2edb7b1facfe6206b79c106

See more details on using hashes here.

File details

Details for the file http_prep-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: http_prep-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.1

File hashes

Hashes for http_prep-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e1140beefea5c4071ba5e79da19f7e0bd7ca63cb7e1c5becd463974e3547e177
MD5 8b03c85e43db8851d247958fef439f7d
BLAKE2b-256 ba3a0abb6a4f06e5d1ab98f3bc7e14d5eca05a5f2c2ce907be46afcb88ce2d1f

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