Skip to main content

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

Metadata

Release files for hx-cookies 0.1.0

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

Source distribution (sdist)

Source distribution for hx-cookies 0.1.0
File Size Uploaded
hx_cookies-0.1.0.tar.gz 5.6 kB Details

Release files / hx_cookies-0.1.0.tar.gz

Download URL hx_cookies-0.1.0.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c457c57279bcdfeb1e55684a3da909461760cc45da80ad518d6f432238b68089
BLAKE2b-256 checksum
How to use checksums
3958017388bf71ac4e51e6ed0a176fe92d39944e21d19c555b6e2c2ba5a61cbc
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

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