Repository navigation
Closed
Conversation
Reddit rejects requests whose TLS fingerprint does not match a real browser, returning 403 regardless of cookies or User-Agent. Replace httpx with curl_cffi (impersonate="chrome") in the transports.
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
rdt statusand every read command (rdt feed, etc.) fail withAccess forbidden: Resource(HTTP 403), even right afterrdt loginwith valid browser cookies. A plain
curlto https://www.reddit.com/from the same machine also returns 403, while the site works normally
in Chrome.
Cause
Reddit rejects clients whose TLS fingerprint does not look like a real
browser.
httpxis rejected regardless of headers, User-Agent or cookies.Fix
Use
curl_cffiwithimpersonate="chrome"inrdt_cli/transports.pyinstead of
httpx, and addcurl_cffito the dependencies.httpx.Client->curl_cffi.requests.Session(impersonate="chrome")httpx.TimeoutException/httpx.NetworkError-> curl_cffi'sTimeout/ConnectionErrorstatus_code,headers,text,json()andcookiesAPI)Testing
rdt status-> "Not authenticated, Access forbidden"rdt status-> "Authenticated", capabilities: read, writeThe 2 failures (
test_status_yaml,test_sub_info_yaml) assert theliteral text
ok: true, but the YAML output is tagged(
"ok": !!bool "true"). The requests themselves succeed, so this isunrelated to the HTTP client change.
ruff checkpasses.ruff format --checkalready reports 7 fileson the base branch;
transports.pyis clean.Notes
This 403 may depend on the environment (network/TLS fingerprint), so it
may not affect every user. Impersonating Chrome should be harmless for
those it does not affect.