Skip to main content

RFC 6265 HTTP cookie parsing and domain/path scoping. Zero dependencies.

Project description

hx-cookies

RFC 6265 cookie parsing and storage. Zero dependencies.

Highlights

  • Parse Set-Cookie headers with domain validation and public suffix rejection
  • Domain/path/secure scoping per RFC 6265
  • Host-only cookies (no Domain attribute) restricted to exact origin
  • Default-path computation per RFC 6265 Section 5.1.4

Usage

from hx_cookies import CookieStore, parse_set_cookie

# Parse a Set-Cookie header
cookie = parse_set_cookie("session=abc; Path=/; Secure", "https://example.com/")

# Store and retrieve cookies
store = CookieStore()
store.extract_cookies("https://example.com/", [("set-cookie", "session=abc")])
header = store.get_cookie_header("https://example.com/api")  # "session=abc"

Public API

  • Cookie - single cookie with domain/path/secure/expiry scoping
  • CookieStore - domain/path-scoped cookie store with dict-like access
  • parse_set_cookie(header, request_url) - parse Set-Cookie header into a Cookie

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

hx_cookies-0.1.0.tar.gz (5.6 kB view details)

Uploaded Source

File details

Details for the file hx_cookies-0.1.0.tar.gz.

File metadata

  • Download URL: hx_cookies-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hx_cookies-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c457c57279bcdfeb1e55684a3da909461760cc45da80ad518d6f432238b68089
MD5 dca7308336aab9456c8939d5b3539f9a
BLAKE2b-256 3958017388bf71ac4e51e6ed0a176fe92d39944e21d19c555b6e2c2ba5a61cbc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page