Repository navigation
Releases
lkrequest-py v0.3.0
Built on the Rust library's 0.3.0, it adds the Chrome 158 fingerprint, caps on
the retries and connections of one request and a summary of what each request
did, a deadline for a body that stops arriving and deadlines that can be turned
off, a lifetime for cached TLS sessions, complete profile bundles, compressed
WebSocket messages and proxy credentials worked out from a 407's challenges.
The Rust library's other changes show on the wire: requests sent at once to an
origin no connection is open to share the one being set up, where each dialed
its own; TLS 1.2 sessions are resumed, by ticket or session ID, until they
expire; the Firefox presets no longer stall HTTP/2 downloads of more than 128
KiB; the Firefox and Safari presets complete the P-521 handshakes they offer;
and a server that accepts permessage-deflate gets compressed messages. Of the
bindings' own changes, quic_fingerprint="chrome_158" sends the ClientHello
Chrome sends inside QUIC rather than its TCP one.
Three changes are visible from Python and worth reading before upgrading: an
HTTP/2 connection whose first request fails is no longer tried again over
HTTP/1.1, and a request whose pooled connection the server closed is no longer
sent again, unless h2_fallback_h1 and retry_on_connection_close turn that
back on; total_timeout now defaults to 120 seconds and also bounds the reading
of a streamed body, so a longer download needs a deadline that fits it; and a
host Hsts.dynamic() learns covers its subdomains only with
includeSubDomains and is forgotten when its max-age runs out.
🚀 Features
- Chrome 158 Fingerprint — Added
Client.chrome_158()/BlockingClient.chrome_158(), the"chrome_158"name fortls_profile=/h2_profile=/quic_profile=, andTlsProfile.chrome_158(),TlsProfile.chrome_158_quic(),H2Profile.chrome_158(),QuicProfile.chrome_158(). Captured from Chrome 158.0.8127.37 on Windows, it matches Chrome 157 throughout: the TCP and QUIC ClientHellos differ only in their name, and the H2, QUIC and HTTP/3 profiles, the header order and the protocol policy are Chrome 157's. The capture confirmed the HTTP/2 and HTTP/3 SETTINGS and the navigation and favicon priority; timing, loss recovery, resumption and 0-RTT carry over from Chrome 157 without being observed again. Like Chrome 152 to 157, it carries Trust Anchor Identifiers, so thetrust_anchor_*options apply to it. The default fingerprint stays Chrome 155. - Profile Bundles — inherited from upstream 0.3.0.
lkrequest.export_preset_json(name)writes a browser preset out as a complete profile bundle, lkrequest's v2 preset JSON: its TLS, QUIC TLS, HTTP/2 and QUIC profiles, header and cookie order, protocol policy and session-cache partitioning.Client.from_preset_json(json, tcp_fingerprint=None)andClient.from_preset_file(path, tcp_fingerprint=None), onBlockingClienttoo, build a client from one, edited or of your own, asClient.<name>()builds one from a preset; a bundle has no TCP fingerprint, so it is given alongside. The Rust library validates a bundle as it reads it, up to 1 MiB, and one it refuses raisesValueErrornaming the reason and the JSON pointer of the value at fault, such asUnknownField at /runtime/surpriseor a protocol policy whose axes contradict one another. - Attempt Limits, And What A Request Did — inherited from upstream 0.3.0. The new
AttemptLimits(extra_http_attempts=..., connect_attempts=...)caps, for one request, the HTTP submissions beyond its first and its redirects — retries and recoveries — and the TCP and QUIC connections it starts; reusing a pooled connection, or waiting for one being set up, starts none. Give it asattempt_limits=to a client, tosession()or to a single request: a session or request inherits the cap above it and can only lower it, and one above raisesValueError, fromsession()for a session and before anything is sent for a request. The caps turn no retry on and replace no timeout, and concurrent requests count separately. EveryResponseandStreamingResponse, and the exception of a request that failed, now hasattempt_summary, a dict of what the request did: its HTTP submissions, the extra ones among them, redirects, recoveries and connection starts, its outcome, why a recovery it could have made was refused, and the limits in effect, each with the scope that set it. Clients and sessions read their limits back asattempt_limitsandeffective_attempt_limits. - How Long A TLS Session Is Cached —
Client(tls_session_cache_ttl=...)andBlockingClient(tls_session_cache_ttl=...)set how many seconds a cached TLS session lives before it is no longer resumed, over TLS 1.2, TLS 1.3 and QUIC alike: by default an hour for TLS 1.2, counted from the session's first full handshake, and seven days for TLS 1.3 and QUIC, which is also the most it can be. A shorter lifetime from the server still wins, and0caches nothing. The read-onlytls_session_cache_ttlreads the setting back,Nonefor the defaults, andtls_session_cache_enabledsays whether sessions are cached at all, whichTlsSessionResumptionPolicy.DISABLEDor a lifetime of zero turns off. - A Deadline For A Body That Stops Arriving, And Deadlines Turned Off —
Client(read_idle_timeout=...)andBlockingClient(read_idle_timeout=...)end a request whose response body, buffered or streamed, goes that many seconds without anything arriving, withTimeoutError; it is off unless set, and reads back intimeouts. Any of the client's timeouts —dns_timeout,tcp_connect_timeout,tls_handshake_timeout,ttfb_timeout,total_timeout,quic_connect_timeoutandread_idle_timeout— now takesmath.infto turn that deadline off, which reads back asNone; before, every one of them had a deadline whatever was given, and infinity raisedValueError. Together they suit a long download:total_timeout=math.inf, read_idle_timeout=30.0. A request's owntimeout=still takes a finite number of seconds. - Compressed WebSocket Messages — inherited from upstream.
ws_connect(..., extensions=["permessage-deflate; client_max_window_bits"]), the offer Chrome makes, now gives a connection that compresses and decompresses its messages once the server accepts the offer, with context takeover, fragmented messages and client windows of 9 to 15 bits; a message that decompresses to more than 64 MiB fails the connection. Before, the offer could be made but every compressed message the server sent failed to be received. Compression is used only when offered, so a connection that offers nothing is unchanged. The handshake now fails withRequestErrorwhen the server accepts an extension other thanpermessage-deflate, more than one, or deflate parameters that match no offer, where the frames used to be read plain regardless. - Proxy Credentials Worked Out From A 407's Challenges — inherited from upstream 0.3.0.
ProxyConfig.with_custom_auth()takeson_challenge=, a function given the proxy'sProxy-Authenticatevalues, each whole and in the order sent, that answers a 407 in place ofauthorize, for a scheme such as Digest that works its credential out from the challenge. It runs on the thread setting the connection up, which waits for it, once for the CONNECT the challenge prompts.None, an exception or anything but a string declines the challenge, and the request fails with aProxyErrorwhoseproxy_error_kindis"authentication_required"; an exception is logged as a warning. Likeauthorize, it must be a plain function: anasync def, or anything that cannot be called, raisesTypeError.
🔧 Changes
- Recovery Only When Asked For — inherited from upstream 0.3.0.
h2_fallback_h1andretry_on_connection_closenow default toFalseon both clients, where both were on: an HTTP/2 connection whose first request fails is no longer tried again over HTTP/1.1, whose fingerprint is not the browser's, and a request whose pooled connection the server has closed fails instead of going out again on a new connection. PassTruefor either to have it back; neither overrides the method's idempotency or a body that cannot be sent twice. The new read-onlyretry_on_connection_closereads the setting back, besideh2_fallback_h1. One effect to look out for: HTTP/2 forbids the headersConnection,Keep-Alive,Proxy-Connection,Transfer-Encoding,Upgradeand aTEother thantrailers. A request given one still sends it, now with a warning logged, and a strict server fails the request, which used to fall back to HTTP/1.1 and succeed; header sets copied from a browser's HTTP/1.1 request often carryConnection: keep-alive. - Two Minutes For A Whole Request, Streaming Included — inherited from upstream 0.3.0.
total_timeoutnow defaults to 120 seconds, where it was 60, and bounds the whole request: connecting, redirects, retries and their backoff, and now the reading of a streamed body too, which it did not bound before. A streamed download that takes longer fails part way withTimeoutError, so give such a download atotal_timeout, or atimeout=of its own, that fits it, ortotal_timeout=math.infand aread_idle_timeout(see A Deadline For A Body That Stops Arriving, And Deadlines Turned Off above). A retry no longer starts a deadline of its own.
🐞 Fixes
- Concurrent Requests Share The Connection Being Set Up — inherited from upstream. Requests sent at once to an origin no connection was open to each dialed one of their own: 50 at once made 50 TCP and TLS connections, where a browser makes one, and with
max_connections_per_sessionset, every request beyond the cap failed withsession connection limit reached. They now wait for the first connection and share it once it turns out to speak HTTP/2, so 50 or 100 at once make one connection and none fails. Over HTTP/1.1, which cannot share a connection, they still dial in parallel. - **A Learned HSTS ...
lkrequest-py v0.2.4
Adds the Chrome 156 and Chrome 157 fingerprints, Trust Anchor Identifiers and a
switch for sending HTTP/1.1 header names in lowercase, and much of what the Rust
library offers and the bindings did not:
every exception now says what failed, pools take their proxies from a function,
names can be looked up by a DNS server of your own or by Python code, log events
can go to Python's logging, and protocol policies, QUIC cooldowns, HSTS
policies, proxy credentials, WebSocket connections and TCP and TLS fingerprints
can be set in full, among the rest listed below. It also moves the bindings to
PyO3 0.30 and refreshes the Rust dependencies, and fixes the proxy pool, which
handed out a key rather than a proxy. Default request headers and request
cookies now go out in the order they were given, as the Rust library sends
them; a copy made by randomize_fingerprint() keeps the options of the client
it copies; and the default fingerprint, Chrome 155, sends its trust-anchor IDs
in Chrome's sorted order instead of shuffling them. Apart from those three, and
unless a new option is used or one Hsts.dynamic() is given to several
sessions, requests go out on the wire exactly as before. Six changes are visible
from Python and worth reading before upgrading: ProxyPool.acquire() now
returns a ProxyLease instead of a string; TimeoutConfig and
ResourceLimits, which nothing accepted, are gone; the exception raised for an
argument of the wrong type no longer names the argument in its message;
Client.session(proxy=...) now raises ValueError for a proxy URL it cannot
parse, where it used to build a session that connected direct; a
ProtocolPolicy whose axes contradict one another raises ValueError when it
is given to a client or a session, rather than on the first request; and the
sessions given one Hsts.dynamic() now share what it learns.
🚀 Features
- Chrome 157 Fingerprint — Added
Client.chrome_157()/BlockingClient.chrome_157(), the"chrome_157"name fortls_profile=/h2_profile=/quic_profile=, andTlsProfile.chrome_157(),TlsProfile.chrome_157_quic(),H2Profile.chrome_157(),QuicProfile.chrome_157(). Captured from Chrome 157.0.8103.39 on Windows, it matches Chrome 156 throughout: the TCP and QUIC ClientHellos differ only in their name, and the H2, QUIC and HTTP/3 profiles are Chrome 156's. The capture confirmed the HTTP/3 SETTINGS and the navigation and favicon priority; timing, loss recovery and resumption carry over from Chrome 156 without being observed again. The default fingerprint stays Chrome 155. - Trust Anchor Identifiers —
ClientandBlockingClienttaketrust_anchor_advertisement=,trust_anchor_recovery=andtrust_anchor_bindings=, for the Rust library's new support of draft-ietf-tls-trust-anchor-ids: the IDs of the roots a client accepts, which the Chrome 152 to 157 profiles send in extension0xca34.trust_anchor_advertisement="trusted"sends the sorted IDs of the roots the client trusts instead of the profile's list.trust_anchor_recovery="once"opens one more connection when a server lists the IDs it can serve and then its certificate chain fails to verify, or it ends the handshake, asking for the first of those IDs the client trusts; at most once per request, with 0-RTT off, and a second failure raises the error of its cause with a message beginningtrust anchor recovery failed.trust_anchor_bindings={id: anchor_identity}gives IDs to roots of your own, and the newlkrequest.trust_anchor_identity(der)computes the identity a binding names a root by; the bundled IDs of the Chrome 157 root store need none. The IDs never change which certificates are trusted. A setting the Rust library rejects raisesValueError: recovery withoutverify, or withproxy_fallback_direct=True,"trusted"or"once"on a profile without the extension or with TLS synthesis, and a binding to a root the client does not load.Response.diagnosticsand thediagnosticsof an exception gainedtrust_anchor, the negotiation of the TLS connection the request opened: the IDs requested and offered, the root that verified the chain and, after a recovery, the first attempt; it isNoneon a pooled connection. Whatever the settings, a TLS failure on a server that listed IDs of its own is no longer retried. - Chrome 156 Fingerprint — Added
Client.chrome_156()/BlockingClient.chrome_156(), the"chrome_156"name fortls_profile=/h2_profile=/quic_profile=, andTlsProfile.chrome_156(),TlsProfile.chrome_156_quic(),H2Profile.chrome_156(),QuicProfile.chrome_156(). Captured from Chrome 156.0.8078.48 on Windows, it matches Chrome 155 throughout: the TCP and QUIC ClientHellos differ only in their name, and the H2, QUIC and HTTP/3 profiles are Chrome 155's. The capture confirmed the HTTP/3 SETTINGS and the navigation and favicon priority updates; timing, loss recovery and resumption carry over from Chrome 155 without being observed again. The default fingerprint stays Chrome 155. - Lowercase HTTP/1.1 Header Names — Added
Client(http1_title_case_headers=...)on both clients, and a read-onlyhttp1_title_case_headersproperty. HTTP/1.1 header names go out in Title-Case (Content-Type) by default, as before;Falsesends them in lowercase (content-type), including generated headers such ascontent-length, except forHost, which keeps its capitalH. It applies to ordinary and streamed requests, preconnected connections and WebSocket handshakes, and leaves header values and order alone. Either way, the spelling a header was given in is not kept, and HTTP/2 and HTTP/3 always send lowercase names. Lowercase names alone do not make a request match what any particular browser sends over HTTP/1.1. - What An Exception Knows About The Failure — Every
RequestErrornow carriesphase,retryable,safe_to_replay,status_code,proxy_error_kind,tls_alertanddiagnostics, read from the Rust library's error, where an exception used to carry its message alone: anHttpStatusErrorcould not give its status code, aProxyErrordid not say whether the proxy wanted credentials or could not be reached, and the timings of a failed request were thrown away.phasenames the step of the connection that failed ("tcp_connect","proxy_tunnel","tls_handshake", …);retryablesays whether trying again could succeed, andsafe_to_replaywhether the server cannot have processed the request, so that even a POST can be sent again;proxy_error_kindsays what went wrong with a proxy ("authentication_required","tunnel_refused", …) andtls_alertwhich alert a handshake ended in;diagnosticsholds the timings and transport so far, in the form ofResponse.diagnostics, for a failed request of the HTTP methods andrequest(), and the response's own forerror_for_status(). An attribute that does not apply isNone, orFalsefor the two flags, on an error built by hand as well, and the attributes survive pickling. A retry callable that also takesexception=(or**kwargs) is given the exception itself, orNonewhen a status is being retried; one taking only(attempt, error, status)is called exactly as before. - Proxies From A Function —
ProxyPool,SessionPoolandBlockingSessionPooltake a function in place of the list of proxies. It is called with no arguments for every proxy the pool hands out and returns a URL or aProxyConfig: the way to use a gateway that picks the exit by a session id in the username, with a new id each time. What the function raises comes out of theacquire()that called it, and so does aValueErrorfor a URL that does not parse or aTypeErrorfor anything but a URL or aProxyConfig, where the Rust library would only log it and keep asking, so thatacquire()waited for good. Anasync defis refused withTypeError. Every proxy from a function is a new one, sorotation,bad_proxy_configandhealth_checkdo not apply to them, andmax_proxies/max_sessionsstill cap how many are out at once. The async pools call the function on a worker thread that waits for it;proxy_buffer=nhasnproxies made ahead of time on a thread of their own, where a failure is logged and the function is called again a second later, rather than at once and over and over as the Rust library would.proxy_buffer=with a list raisesValueError. - Blocking
ProxyPool— Addedlkrequest.blocking.ProxyPool(lkrequest.BlockingProxyPool), which takes the same arguments asProxyPool, blocks inacquire()andacquire_fresh(), and hands out the sameProxyLease. bad_proxy_config=Andhealth_check=For Session Pools —SessionPoolandBlockingSessionPoolnow take theBadProxyConfigandHealthCheckConfigthatProxyPoolalready did, so a session pool can cool a failing proxy down after fewer or more failures than the default three, and probe its proxies in the background.- A DNS Server Of Your Own —
Client(dns=...)andBlockingClient(dns=...)now take the address of a DNS server besides the seven resolver names:"ip"for port 53, or"ip:port", an IPv6 address with a port in brackets ("[2606:4700::1111]:53"). It is asked over UDP, and over TCP for an answer too long for UDP. Like the named public resolvers and unlike the system one, it also answers HTTPS records, which is how the client learns a site's ECH configuration and HTTP/3 support from DNS. Anything that is neither a name nor an address still raisesValueError, whose message now mentions the address form. - Python Code As The Resolver —
dns=also takes Python code that looks names up: a functionresolve(host, port)returning a list of addresses, each an IP, which takes the requested port, or"ip:port"; or an object with that method and, optionally,lookup_https(host), returningNoneor the host's HTTPS record as a dict ofalpn,no_default_alpn,target,port, `ech...
lkrequest-py v0.2.3
Adds the Chrome 155 fingerprint and picks up upstream's switch of the default
fingerprint to it, plus upstream hardening of length fields read off the wire.
Sessions can now be closed, and a session whose event hooks refer back to its
owner is reclaimed instead of living for good. HTTP/2 requests abandoned after
they were sent are now reset instead of holding their stream open, a WebSocket
can send and close while another task is receiving, and upstream's pass over TLS,
ECH and QUIC handshake behaviour is picked up, along with fixes to what a
redirect carries along and to how a few responses are read. Several things are
worth reading before upgrading, because they change the wire or what a call
returns: a client built without a TLS or HTTP/2 profile now presents Chrome 155
instead of Chrome 144; Firefox 156 and the Chrome presets differ in their HTTP/2
stream numbering and dependencies; a redirect to another origin no longer carries
the client's default Authorization, Cookie and Host headers along; a
Set-Cookie with an empty Max-Age gives a session cookie instead of one that
lasts until the year 9999; a deflate body that ends early is now an error; and
ProxyPool.acquire() now waits, rather than answering "no proxy", while every
proxy is cooling down.
🚀 Features
- Closing A Session — Added
Session.close()andSession.closedon both session classes, and context-manager support:withonBlockingSession,async withonSession. Closing aborts the pooled connections, abandons the requests still in flight — they raiseRuntimeError("Session was closed while the request was in flight")instead of carrying on — drops the event hooks and the callbacks of the session's own middleware, and makes the session refuse further requests and new hooks withRuntimeError("Session is closed"). Closing twice is harmless and cookies stay readable. Until now the only way to let go of a session's connections waspool_clear(), which empties the pool but leaves requests in flight running and the session usable; it is unchanged.Clienthas no counterpart, since it owns no connections — those belong to its sessions. The README gained a "Session lifecycle and memory" section: reuse a session rather than creating one per request, the default pool has no upper limit and drops an idle connection after 300 seconds (only when the session is next used), and the resident size of a process does not necessarily shrink when memory is freed. - Chrome 155 Fingerprint — Added
Client.chrome_155()/BlockingClient.chrome_155(), the"chrome_155"name fortls_profile=/h2_profile=/quic_profile=, andTlsProfile.chrome_155(),TlsProfile.chrome_155_quic(),H2Profile.chrome_155(),QuicProfile.chrome_155(). Captured from Chrome 155.0.8059.40 on Windows: the TCP and QUIC ClientHellos, H2, the QUIC transport parameters and the Initial-packet generation rules all match Chrome 154. What differs is how the QUIC profile behaves once connected:QuicProfile.chrome_155()switches on 16 booleans that Chrome 154's lacks — Chrome 155's HTTP/3 request handling (among them a PRIORITY_UPDATE sent for each request stream before its HEADERS) and its loss-recovery and packetization timing — and nothing else in it moves. Unlike the Chrome 154 capture, this one completed an HTTP/3 navigation, so the H3 SETTINGS were observed directly rather than carried over — and matched the inherited ones. - The Default Fingerprint Is Now Chrome 155 — inherited from upstream, and visible on the wire.
Client()/BlockingClient()withouttls_profile=used Chrome 144's TLS fingerprint and now uses Chrome 155's; withouth2_profile=, the same for HTTP/2. Nothing else about the default changes: no TCP fingerprint, no QUIC profile, no default headers. The preset methods and named profiles are unaffected. Passtls_profile="chrome_144", h2_profile="chrome_144"to keep the previous default. - Per-Request HTTP/2 Priority Weight — Added
h2_priority_weight=(0–255) to every request method on both session classes. It sets the weight in the legacy priority field of the request's HTTP/2 HEADERS frame — on the request that opens a connection as on any other — independently of thepriorityheader, the stream dependency and the exclusive flag; the next request goes back to the weight its profile sends. A profile whose HEADERS carry no legacy priority field (Safari 26) still sends none, and HTTP/1.1 and HTTP/3 are not affected. It is what reproduces Firefox 156's favicon request:priority=RequestPriority(6, False)together withh2_priority_weight=21. A value outside 0–255 is rejected before anything is sent. - HTTP/2 Stream Numbering And Dependencies — Added
H2Profile(initial_stream_id=...)and a read-onlyinitial_stream_id: the ID of the first request stream a connection opens, an odd number up to 2³¹ − 1 (ValueErrorotherwise; a profile saved without it keeps starting at 1). Added"priority_chain"as aPriorityConfig(stream_dep_policy=...)value. Two presets change on the wire as a result. Firefox 156 now opens its first request on stream 3, as its capture shows, and sends navigation HEADERS with weight 41 where it sent 42. The Chrome presets now point each stream's dependency at the newest still-active stream of equal or higher priority, dropping finished and reset streams, instead of at the stream opened just before it:PriorityConfig.chrome().stream_dep_policyis"priority_chain"where it was"chain"."chain"itself behaves as it did. - HTTP/3 Protocol-Error Retries — Added
H3RetryModeandsession(h3_retry_mode=...)on both clients.H3RetryMode.Safe, the default, keeps the behaviour of earlier releases.H3RetryMode.Chrome155ProtocolErrorsretries HTTP/3 stream and connection protocol errors and stateless resets up to twice per redirect hop, as long as no response headers have arrived, which is what Chrome 155 does. That replays a finite buffered request, including a POST the server may already have processed. Streaming uploads are not retried, a request sent withidempotency=Idempotency.NotIdempotentopts out, and a request that is not HTTP/3-only needs a protocol policy that allows falling back to TCP. It adds no status-code retries and leaves 0-RTT eligibility alone. Without thequic-h3build feature onlySafeis accepted.
🐞 Fixes
- Event Hooks No Longer Keep Their Session Alive — a hook that referred back to the object holding the session —
session.on_response(self.log)in a class that storesself.session, or a closure over the session — made a reference cycle that Python's collector could not see, because the hooks sat in a RustVecbehind anArc. The session, its connection pool and everything the owner held then stayed alive for the life of the process: on the order of 7 KB per session in a loop that created one per request, plus its open connection for as long as the server kept it open. The hooks are now kept in Python lists and the session classes report them to the collector, so such a cycle is reclaimed. The callbacks of middleware are still held where the collector cannot see them: those of a session's own middleware are released bySession.close(), and a callback ofClient(middleware=...)that refers back to its own client keeps that client alive, so create such a client once rather than per request. - Overflow-Checked Length Fields — inherited from upstream. Lengths declared in HPACK, QUIC transport parameters and MASQUE capsules were added to buffer offsets without overflow checks, and on a 32-bit target a declared length of 4 GiB or more was truncated outright. They are now compared against the bytes actually present. The one place this surfaces in Python is
H2Profile.from_h2_frames(): a header block whose declared lengths run past the frame now ends the pseudo-header scan at the last field that fits, instead of relying on unchecked arithmetic. - Abandoned HTTP/2 Requests Are Reset — inherited from upstream. A request the caller gave up on after it was sent — a timeout, a cancelled task, a dropped streaming response — was never reset with
RST_STREAM, so its stream stayed open on the server for as long as the connection did. On a shared session that used up the server's concurrent-stream limit (typically 100): later requests then queued behind it without ever being sent, every one of them timed out, and the pool still counted the connection as healthy. A dropped session also kept its connections open for another 30 seconds, waiting out the abandoned streams. The client now sendsRST_STREAM(CANCEL)for such a request and frees its slot, and a dropped session closes its connections at once. HTTP/1.1 was never affected. - WebSocket Send And Close No Longer Wait For
recv()— a connection held one lock across every operation, so while one task was waiting inrecv(),send_text(),send_binary()andclose()from any other task or thread waited too. Against a server that only speaks when spoken to that is a deadlock: the messagerecv()is waiting for is the onesend_text()cannot send. Receiving, sending and closing now proceed independently, and closing hands arecv()that is waiting the closing handshake. As before, once a connection is closed every operation raisesRuntimeError("WebSocket is closed")and iterating it ends. - WebSocket Upgrade Request Line And Host — inherited from upstream. The HTTP/1.1 upgrade request went out in absolute-form (
GET https://host/path), which only a proxy is meant to receive, and itsHostheader dropped the port. A server that routes on the path never matched it, and awss://endpoint on any port but 443 was addressed as if it were on 443. The request line is now the path and query, andHostcarries the port whenever it is not the scheme's default. ProxyPool.acquire()Does Not Answer With "No Proxy" While Proxies Cool Down — inherited from upstrea...
lkrequest-py v0.2.2
Adds streaming uploads, the Chrome 153, Chrome 154 and Firefox 156 fingerprints,
experimental MASQUE (CONNECT-UDP) proxies and address-family control with dial
target overrides, makes text() usable on the non-UTF-8 web, and picks up three
upstream fixes: a connection-pool bug that made every request re-dial whenever
HTTP/3 fell back to HTTP/2, a QPACK bug that made HTTP/3 connections built from
the Chrome presets unusable after their first request against servers such as
LiteSpeed, and HTTP/3 never reaching an IPv6 address. Six behaviour changes are
worth reading before upgrading: what text() does with bytes it cannot decode,
the exception json() raises, the order of the Cookie header, the QUIC GREASE
fields the Chromium presets now randomize per connection, the default port for a
portless HTTP proxy URL, and the encoding of ProxyConfig.identity().
🚀 Features
- Streaming Uploads — Added
body_stream=andcontent_length=topost,put,patch,delete,requestandsend_streamingon both clients, uploading without holding the body in memory.body_streamaccepts a file-like object (read(n)), any iterable ofbytes, or — on the async client — an async iterable; the blocking client rejects an async iterable up front, since it has no event loop to drive it. Omitcontent_lengthfor an unknown-length body: HTTP/1.1 then uses chunked framing, HTTP/2 and HTTP/3 send DATA frames with noContent-Length. A supplied length is exact, so a source that ends short or runs long fails the request. Chunk boundaries are passed through untouched rather than re-chunked, because they are visible on the wire as DATA frame sizes. The source is single-use: neither an automatic retry, a protocol fallback, nor a redirect that must preserve the body can replay it. - HTTP/2 Dispatch Batching — Added
Client(h2_dispatch_batch_size=...)and a matching read-only property, capping how many ready HTTP/2 requests are coalesced into one driver write turn. The default of 1 keeps each request in its own write, which is the shape the browser presets were captured with; batching is faster but observable, so it is opt-in.0is rejected withValueError. - Readable Cookie Attributes — Added
session.get_cookies_with_attrs(url)andsession.get_all_cookies()on both clients, returningCookieobjects carryingname,value,domain,host_only,path,secure,http_only,same_site,expiresandis_persistent.get_cookies()returns(name, value)pairs, which cannot tell apart two cookies sharing a name at different paths — the jar holds both, and only the attributes say which is which. These are what a caller needs to hand a jar to a browser automation context, to persist a login and know which cookies are session-only, and to answer why a cookie the jar holds was not sent.get_cookies_with_attrsis scoped to a URL likeget_cookies;get_all_cookiesspans every domain, which is the view to persist.Cookieis hashable, so two jars can be diffed with set operations.get_all_cookieslists cookies oldest first, which is the order to write them back in: combined with theCookieordering fix below, a jar saved and restored reproduces the same headers on the wire. - Address Family Selection — Added
Client(ip_family="any" | "ipv4" | "ipv6")on both clients, backed by upstream's address-family policy. On a dual-stack host the OS resolver orders IPv6 ahead of IPv4 (RFC 6724), so a target publishing an AAAA record is reached over IPv6 whenever IPv6 happens to work;"ipv4"or"ipv6"keeps every address this process dials — the target, the proxy's own address, a SOCKS5 UDP relay, QUIC — within one family, which is what keeps a session from leaving over two families and presenting two source addresses to the target."ipv6"also refuses IPv4-mapped addresses (::ffff:a.b.c.d). The default"any"is the previous behaviour. An address outside the family raises an error that names theip_familysetting (LkConnectionError, orProxyErrorfor the proxy's own address) instead of falling back — not even to a direct connection underproxy_fallback_direct=True— and an unknown value raisesValueError. Composes withdns=and withsystem_dns_cache_ttl=. A proxy that resolves the target itself — HTTPCONNECT,socks5hor MASQUE handed a hostname — still picks the family it dials;connect_tohands it an address instead. - Dial Target Overrides — Added
Client(connect_to={"host:port": "ip:port"})on both clients: requests to that origin dial the given address, while the URL, TLS SNI and certificate name,Host, cookies and connection pooling keep the original host. It applies to direct, proxied and HTTP/3 connections, ahead of Alt-Svc / SVCB endpoints, and never to the proxy's own address; through an HTTPCONNECTproxy theCONNECTline carries the address, which is how to decide the family a proxy dials. An IPv6 host or address goes in brackets ("[::1]:8443","[2001:db8::1]:443"). The mapping is fixed — nothing re-resolves or refreshes it. A malformed entry, a zero port, one origin listed twice (Example.comandexample.comcount as the same), or an addressip_familyexcludes raisesValueErrorwhen the client is built. - Chrome 153 Fingerprint — Added
Client.chrome_153()/BlockingClient.chrome_153(), the"chrome_153"name fortls_profile=/h2_profile=/quic_profile=, andTlsProfile.chrome_153(),TlsProfile.chrome_153_quic(),H2Profile.chrome_153(),QuicProfile.chrome_153(). Captured from Chrome 153.0.8010.37 on Windows. Against Chrome 152 the TLS shape is the same except for the shuffled trust-anchor list (extension0xca34), which narrows from 32 identifiers to 28; H2 is unchanged; the QUIC ClientHello keeps the nine classic signature algorithms and sends no TLS GREASE slots. Nothing switches over on its own — an existing client keeps the preset it names. - Chrome 154 And Firefox 156 Fingerprints — Added
Client.chrome_154()/BlockingClient.chrome_154(), the"chrome_154"name fortls_profile=/h2_profile=/quic_profile=, andTlsProfile.chrome_154(),TlsProfile.chrome_154_quic(),H2Profile.chrome_154(),QuicProfile.chrome_154(). Captured from Chrome 154.0.8037.58 on Windows: the TCP and QUIC ClientHellos, H2, the QUIC transport parameters and the Initial-packet generation rules all match Chrome 153, so only the profile name differs. The capture never received a QUIC response, so the H3 SETTINGS and request priority carry over from Chrome 153's completed navigation instead of being observed anew. AddedClient.firefox_156()/BlockingClient.firefox_156(), the"firefox_156"name fortls_profile=/h2_profile=, andTlsProfile.firefox_156(),H2Profile.firefox_156(). Captured from Firefox 156.0.1 on Windows: against Firefox 147 the TLS profile drops two ECDSA CBC suites (0xc009,0xc00a) and both FFDHE groups (256, 257), and its ECH GREASE switches to AES-128-GCM with a fixed 240-byte payload; H2 is unchanged. Like the other Firefox presets it carries no QUIC profile and turns HTTP/3 off — upstream captured Firefox 156's QUIC Initial but cannot yet reproduce every field of it — so there is no"firefox_156"QUIC name. As before, an existing client keeps the preset it names. - Chromium GREASE Generation For The QUIC Presets — inherited from upstream, and it changes the wire for existing presets, not just Chrome 153. Three fields are now generated per connection the way Chromium generates them, instead of being fixed by the profile: the reserved HTTP/3 SETTINGS id and value plus the control-stream GREASE frame (every Chrome
QuicProfile, the genericchromeincluded); the reserved QUIC transport parameter ids, now spanning the full 62-bit range with 0–15 byte payloads and a randomized GREASE version position; and the Initial packet layout, with CRYPTO data split and shuffled and PING/PADDING interleaved (both on Chrome 146 and 150–154). Two connections from one client therefore no longer look byte-identical in those fields — which is what real Chrome does, and the reason a fixed value was a fingerprint of its own. AQuicProfileloaded from JSON is unaffected: the three flags default to off, so a serialized or hand-built profile keeps its previous behaviour. - MASQUE Proxies (Experimental) — experimental upstream and here:
MasqueConfig, themasque=/tunnel_probe=parameters and the behaviour ofmasque://routes may change in any release without a deprecation period, and interoperability has been checked only against test proxies, not against independent production MASQUE deployments. Behind the newmasquebuild feature, which impliesquic-h3and is compiled into the published wheels; it does nothing unless amasque://proxy is used. Amasque://proxy (port 443 by default) carries the QUIC connection to the target inside an RFC 9298 CONNECT-UDP tunnel over an HTTP/3 connection to the proxy; the target is named in the tunnel request, so DNS resolves proxy-side as withsocks5h. AddedMasqueConfigfor the hop to the proxy —server_name,ca_cert(PEM file) /ca_cert_pem,use_native_certs,verify, and the two tunnel-lifecycle knobstunnel_idle_timeout(default 120 s,Nonenever retires an idle tunnel) andmax_idle_tunnels(default 256,0removes the cap) — passed asClient(masque=...)on both clients. Its trust settings are deliberately independent of the client'sverify/ca_cert*, which govern the origin: relaxing one hop for debugging never relaxes the other. A PEM bundle that is malformed or holds no certificate raisesValueErrorinstead of leaving the trust store unchanged.HealthCheckConfiggainedtunnel_probeandmasque: a TCP connect proves nothing about a MASQUE proxy, so by default the health check skips those proxies — neither credited nor blacklisted — and withtunnel_probe=Trueit opens a real CONNECT-UDP tu...
lkrequest-py v0.2.1
Adds the Chrome 152 preset and browser network session policies, and picks up a
large upstream RFC-compliance pass. Several fixes below change observable
behaviour — the ECH, retry, redirect, cookie and connection-limit entries are
the ones most likely to affect existing code.
🚀 Features
- Chrome 152 Preset — Added
Client.chrome_152(),BlockingClient.chrome_152(),TlsProfile.chrome_152(),TlsProfile.chrome_152_quic(),H2Profile.chrome_152(),QuicProfile.chrome_152(), and the"chrome_152"TLS/H2/QUIC profile names. Chrome 152 is currently the only preset that applies GREASE tosignature_algorithms, and it carries the new trust anchor IDs extension. HTTP/2 is unchanged from Chrome 151; the QUIC capture drops thegoogle_initial_rtttransport parameter (0x3127). - Browser Network Session Policies — Added
TlsSessionResumptionPolicy(BROWSER_DEFAULT/DISABLED/enabled(max_tickets_per_server)),TlsSessionCachePartitionPolicy(UNPARTITIONED/TOP_LEVEL_SITE/TOP_LEVEL_AND_FRAME_SITE/CHROMIUM/FIREFOX), andNetworkPartitionContext(top_level_site, frame_site). Set the first two viaClient(tls_session_resumption_policy=..., tls_session_cache_partition_policy=...)and pass the third tosession(network_partition_context=...)to reproduce a browser's per-site ticket isolation. These control whether tickets are stored and how the cache is keyed;SessionResumptionConfigcontinues to control which resumption modes the ClientHello advertises. - HTTP/2 DATA Frame Policy — Added
Client(h2_data_frame_policy=...)withH2DataFramePolicy.BROWSER_DEFAULT,.PEER_MAX_FRAME_SIZE,.fixed_payload(n), and.socket_write_aligned(n), choosing how request bodies are split into DATA frames. The default keeps the browser preset's native framing, since frame sizes are themselves an observable fingerprint trait. - Strict TLS close_notify — Added
Client(require_close_notify=True)and a matching read-only property. When enabled, a response body truncated by a bare socket EOF — with no TLSclose_notifyalert — is reported as an error instead of being accepted as a complete body. One part applies regardless of the flag: the read loop now stops atclose_notifyinstead of reading on, because anything arriving after it did not come from the peer — those bytes were previously appended to the response body. - Trust Anchor IDs Extension — Added
ExtType.TRUST_ANCHOR_IDSand a newExtensionSpecsource:ExtensionSpec(ExtType.TRUST_ANCHOR_IDS, source="trust_anchor_ids", trust_anchor_ids=[...], shuffle=False), withtrust_anchor_idsandshufflereadable back off the spec. - DNS-over-HTTPS Feature — Upstream moved the DoH resolvers behind a
dohCargo feature. The published wheels enable it, sodns="google_https","cloudflare_https"and"quad9_https"keep working exactly as before; a reduced-feature source build now rejects those three names with an actionable error instead of a generic "unknown DNS config".
🐞 Fixes
- A Rejected ECH No Longer Falls Through In The Clear — when a server did not accept Encrypted ClientHello, the handshake previously carried on and handed back a connection whose real server name had never been protected, so the request ECH existed to hide went out in the open. The handshake now aborts before any traffic keys exist, and the session redials once with the
retry_configsthe server supplied — the same thing a browser does, so routine ECH key rotation stays transparent. Retrying without ECH is deliberately not a fallback. This affects clients that never setech_config=, because ECH is enabled automatically from DNS HTTPS records; a rejection that cannot be retried now surfaces asTlsError. GREASE ECH is unaffected. - Status-Code Retries Are Gated On Replay Safety — a non-idempotent request answered with a status in the retry set was replayed even though the answer proves the server received it, so a
POSTanswered502was sent twice. Such a method is now retried only on a status that says it was not applied (429,503);502,504and the Cloudflare520–530range are returned to the caller instead. Safe methods are unaffected, and passingidempotency=Idempotency.Idempotenton the request restores the old behaviour per call. - Only Real Redirect Statuses Are Followed —
300,304,305and306are no longer treated as redirects. Previously a304 Not Modifiedor a305 Use Proxycould send the client chasing aLocationheader it should have ignored.301,302,303,307and308are unaffected. - Cookie Name Prefixes Enforced — Cookies named with the
__Secure-or__Host-prefix are now rejected unless they satisfy the prefix rules (Secure, and for__Host-also a/path with noDomain). A server can no longer set a lookalike cookie that client code would reasonably trust. - Secure Cookies Ignored Over Plain HTTP — A
Set-CookiecarryingSecurereceived over a plain-HTTP channel is now discarded rather than stored. - Sessions Are No Longer Capped At 64 Connections — The implicit per-session ceiling made unrelated high-concurrency workloads fail with
session connection limit reached. The default is now unbounded; setmax_connections_per_sessionexplicitly to impose a budget. - Multi-Layer Content-Encoding Is Decoded — A response carrying stacked encodings (for example
Content-Encoding: gzip, br) is now fully decoded instead of being returned partly compressed. The zlib-wrapped form ofdeflateis also accepted, matching what browsers tolerate. - WebSocket Handshakes And Close Codes Are Validated — the upgrade response was checked only for a
101, which on its own proves nothing; a wrong or missingSec-WebSocket-Acceptmerely logged a warning. RFC 6455 §4.1 makes that, a missing or wrongUpgrade/Connection, and any unoffered extension or subprotocol grounds for failing the connection, and all are enforced now. Enforcing it also uncovered thatSec-WebSocket-Acceptwas being computed with a GUID that is not the one §1.3 specifies, so the token never matched a conforming server — harmless while the check only warned. On the sending side,1005,1006and1015may never appear on the wire (§7.4.1) and are now rejected locally, along with over-long close reasons, instead of producing an invalid frame. - HSTS Is Learned Only From Secure Transport —
Strict-Transport-Securityis no longer recorded from a plain-HTTP response, and never for IP-literal hosts. - Multipart Bodies Match Chrome — Boundary generation and parameter escaping now follow Chrome's format. A
Content-Typecontaining CR or LF is rejected outright, since — unlike the quotedContent-Dispositionparameters, which are escaped — it cannot be encoded safely and would be a live header-injection vector. - Redirect Method Rewriting Follows The Spec — The request method is now rewritten only in the cases the specification calls for, so
307and308correctly preserve the original method and body. - Graceful HTTP/2 GOAWAY Is Honoured — a graceful shutdown carries
NO_ERRORand therefore set no connection error, while the draining check keyed off "has an error". The driver kept opening streams on a connection the peer had already promised to refuse. Google and Cloudflare send these routinely for connection turnover, so this showed up as sporadic failures under sustained load; queued requests now fail over to a fresh connection. - Alternative Services No Longer Supply The TLS Identity — an Alt-Svc entry or DNS HTTPS record says where to send packets, but the endpoint must still prove it may serve the origin. The advertised host was used as the SNI and certificate name, so the alternative authenticated as itself. Besides the trust problem this broke conforming deployments outright, since an HTTPS RR
TargetNameis typically a CDN-internal name serving the origin's certificate. - Certificates Compressed With zstd Decompress —
compress_certificateadvertises zlib, brotli and zstd (the Firefox 147 profile offers all three), but only zlib and brotli could be decoded, so a server that picked zstd failed the handshake. All three are handled now (RFC 8879). - Coalesced TLS Post-Handshake Messages Are Reassembled — post-handshake messages follow the same framing as the handshake: several may share one record, and one may span several. Each record was treated as exactly one message, so a
KeyUpdatesharing a record with aNewSessionTicketwas silently dropped — read keys were never rotated and every record after it failed to decrypt — and coalesced tickets past the first were lost. - Protocol Hardening Across TLS, HTTP/2, QUIC And Alt-Svc — Picks up a broad upstream compliance pass: TLS 1.2 renegotiation is refused with a fatal alert, the record layer and session-ticket trust are bounded, servers can no longer select parameters the client never offered, HTTP/2 enforces response pseudo-header rules and closes connections on peer protocol errors,
record_size_limitis honoured when sending (RFC 8449), draft HTTP/3 Alt-Svc advertisements are ignored, and SOCKS5 authentication replies are version-checked.
lkrequest-py v0.2.0
🚀 Features
- System DNS Positive Cache — Added
system_dns_cache_ttlandsystem_dns_cache_max_entriestoClientandBlockingClient. The OS resolver already coalesces concurrent identical lookups process-wide; these cache successful, non-empty results forttlseconds (default capacity 1024 entries). A0TTL keeps the coalescing while disabling the cache. It selects the system resolver, so it cannot be combined withdns; errors and empty results are never cached. - Shutdown Draining — Added
drain_pending(timeout=None), its blocking counterpartblocking_drain_pending(...), andpending_requests(). Waiting for in-flight work before tearing down an event loop means results are still delivered rather than dropped on arrival. Counts are process-wide and cover every async call, not only requests. - HTTP/2 Pending-Request Bound — Added
max_pending_h2_requeststoClientandBlockingClient. HTTP/2 requests that exceed the peer's concurrent-stream limit now wait for a stream slot instead of failing, and this option caps how many may queue. Omit it (the default) for an unbounded queue;0is rejected withValueError. - Synthetic Fingerprint Negotiability (
synthetic-fp) — AddedNegotiabilityFloor.UNIVERSAL,NegotiabilityFloor.PRESET_FAMILY,NegotiabilityFloor.custom(...), andRandomize.negotiability(...)so synthesized ClientHello profiles retain a configurable signature-algorithm compatibility floor. - Multi-hop Proxy Chains — Added
ProxyConfig.parse_chain(...)and.through(...), with chain metadata viahop_count()andidentity(). Client sessions, proxy pools, and session pools now accept either proxy URLs orProxyConfigobjects. - Mixed Proxy Transports — HTTP/1.1 and HTTP/2 can traverse ordered combinations of HTTP CONNECT, SOCKS5, and SOCKS5H hops. QUIC/HTTP3 supports all-SOCKS5 chains when the optional
quic-h3feature is enabled. - QUIC-TLS Profile Presets — Added
TlsProfile.chrome_146_quic(),TlsProfile.chrome_150_quic(), andTlsProfile.chrome_151_quic(), exposing the ClientHello Chrome sends inside QUIC (previously reachable only through the bundledClient.chrome_1xx()presets). Pass one toClient(quic_fingerprint=...)when building a client manually; HTTP/3 otherwise reuses the main TLS profile. - Chrome 151 Preset — Added
Client.chrome_151(),BlockingClient.chrome_151(),TlsProfile.chrome_151(),H2Profile.chrome_151(),QuicProfile.chrome_151(), and the"chrome_151"TLS/H2/QUIC profile names. Captured from Chrome 151.0.7922.72: TCP TLS and HTTP/2 keep Chrome 150's stable fields, while the QUIC-TLS capture omits the three ML-DSA signature algorithms; QUIC transport parameters and HTTP/3 SETTINGS stay aligned with Chrome 150. - Chrome 150 QUIC/H3 (
quic-h3) —Client.chrome_150()now uses dedicated Chrome 150 QUIC TLS and HTTP/3 profiles instead of reusing Chrome 146. The preset covers captured signature algorithms, QUIC transport parameters, QPACK limits, navigationPRIORITY_UPDATE, connection-ID lengths, and Initial datagram sizing. AddedQuicProfile.chrome_150()and the"chrome_150"QUIC profile name.
🐞 Fixes
- No More Crashes From Late-Completing Requests — A request that finished after its event loop had closed used to print a
RuntimeError: Event loop is closedtraceback from whichever worker thread it landed on. Enough of them at once turned intoFatal Python error: _enter_buffered_busyand killed the process with SIGABRT — uncatchable, and it took the whole batch down. Results arriving after the loop closes are now dropped silently, since nothing is left to receive them. - Multi-Address Connect Fallback — Connecting now tries every address a hostname resolves to, racing them Happy Eyeballs style (RFC 8305) with interleaved address families, rather than giving up when the first candidate is unreachable. Applies to direct TCP and to SOCKS5 proxies.
- HTTP/2 Stream-Limit Backpressure — Requests beyond the peer's advertised
MAX_CONCURRENT_STREAMSnow wait asynchronously for a stream slot instead of failing with a local capacity error. - Redirects Over Reused HTTP/1.1 Connections — Following a redirect no longer fails when the pooled HTTP/1.1 connection was torn down in the meantime. The reuse attempt surfaces as hyper's
operation was canceled, which is now recognised as a closed connection, so the request is retried on a fresh connection instead of erroring out. Affects any server that hangs up after answering a3xx— a common pattern afterPOST. - HTTP/2
1xxInterim Responses — The HTTP/2 driver now consumes1xxinformational responses — such as the103 Early HintsCloudflare sends ahead of its200— and returns the final response that follows, instead of reporting the interim status as the final one. A plainGET https://www.cloudflare.com/previously came back as103. - Connection Limit Enforcement —
max_connectionsnow bounds physical connections, counting those still being dialled and those checked out by an in-flight request rather than only what sits idle in the pool. Exceeding the limit raises instead of quietly opening another connection, and an idle HTTP/1.1 connection is evicted first so one origin's idle connections cannot starve another.PoolStats.totalcorrespondingly reports physical connections in use rather than pooled entries. - Optional Client Certificate Requests — A server that asks for a client certificate no longer breaks the handshake. TLS 1.2 and TLS 1.3 now answer a
CertificateRequestwith an empty clientCertificatemessage — echoing the request context on TLS 1.3, as RFC 8446 §4.4.2 requires — so endpoints with optional mutual TLS complete the handshake instead of failing. - TLS Handshake Reassembly — TLS 1.2 and TLS 1.3 handshake messages fragmented across multiple records are now buffered and reassembled correctly, preventing failures such as
truncated handshake message in recordwithout changing ClientHello or fingerprint output. - SOCKS5 UDP Relay Compatibility — QUIC-over-SOCKS5 accepts relay replies from the advertised source IP even when the relay uses a different egress port, preventing affected HTTP/3 requests from hanging.
- Package Version Reporting —
lkrequest.__version__is now read from installed distribution metadata instead of being maintained as a separate hard-coded value. - TLS 1.3 ECH + HelloRetryRequest — Real ECH CH2 now reuses the ECH configuration, HPKE sender context, Inner random, GREASE values, extension permutation, and fake ECH bytes. HRR confirmation, selected groups, cookie-only retries, invalid extensions, dummy CCS, and local fatal alerts now follow the browser/RFC flow.
- ECH + PSK + HRR Binders —
pre_shared_keyremains exclusively inClientHelloInner; CH1 and CH2 binders now use the correct truncated Inner transcripts, includingmessage_hash(ClientHelloInner1) + HRRfor CH2. - QUIC/H3 HRR State Transitions — QUIC revokes 0-RTT stream and packet state after HRR and maps local TLS alerts to QUIC
CRYPTO_ERRORcodes.
lkrequest-py v0.1.1
🐞 Fixes
- Project URLs —
Homepage,Repository, andIssuesin the package metadata pointed at a repository path that does not exist, so every link on the PyPI project page returned 404. They now point atgithub.com/EZ-XLabs/lkrequest-py. - README Links on PyPI — the language switcher at the top of both READMEs used relative paths (
README.md/README-zh.md), which PyPI cannot resolve when it renders the long description. Both now use absolute URLs, so switching between English and 简体中文 works from the project page.
📝 Documentation
- Development Setup — the setup section now walks through the full local workflow on Linux/macOS and Windows: creating and activating a virtualenv, installing maturin,
pip install -e ".[test,lint]", and running the suite viajust test. An equivalentuv sync --extra test --extra lintpath is documented alongside it.
lkrequest-py v0.1.0
🚀 Features
- TLS Fingerprint Control — Byte-level ClientHello generation that matches real browsers (Chrome, Firefox, Safari)
- HTTP/2 Fingerprint Control — SETTINGS frame order, pseudo-header order, WINDOW_UPDATE, PRIORITY frames, and per-request priority weights
- HTTP/3 + QUIC — Optional
quic-h3feature for full HTTP/3 over QUIC with fingerprint-aware Transport Parameters, Alt-Svc auto-discovery, and H2→H3 seamless upgrade - Built-in Browser Presets — Chrome 131/144/145/146/147/148/149/150, Firefox 133/147, Safari 18/26 (TLS + H2, plus QUIC when
quic-h3is enabled) - Session Management — Cookie jars, connection pooling, HTTP/2 multiplexing, and optional QUIC 0-RTT session resumption
- Connection Prewarming —
session.preconnect()pre-establishes DNS + TCP + TLS + H2 (or, withquic-h3, QUIC + H3) connections - Custom DNS Resolver — Pluggable DNS with DoH support, auto ECH config and H3 hints via HTTPS/SVCB records
- Alt-Svc Discovery — Automatic HTTP/2 → HTTP/3 protocol upgrade via Alt-Svc headers with broken-QUIC fallback
- SessionPool — High-concurrency pool with proxy rotation (round-robin / random)
- Proxy Support — SOCKS5 and HTTP CONNECT with authentication
- WebSocket — HTTP/1.1 Upgrade (RFC 6455) and H2 Extended CONNECT (RFC 8441)
- Middleware — Interceptor chain for request/response modification
- Retry Policies — Exponential backoff, fixed interval, custom strategies; idempotency-aware (non-idempotent methods are not silently replayed after a possibly-already-sent failure unless marked
Idempotency::Idempotent) - Redirect Control —
RedirectPolicy::Follow(n)orRedirectPolicy::Nonefor manual handling - Auto-Decompression — Brotli, gzip, deflate, zstd
- Blocking API — Synchronous wrapper for non-async contexts
- Multipart/Form-Data — File uploads with streaming support
- TCP Fingerprint — JA4T-style TCP SYN fingerprinting