You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
prawcore is currently tied to requests and asyncprawcore to aiohttp. I like how httpx has both async and sync capabilities and would like to use one HTTP library in my project as I will be calling other APIs as well. I would also like to see if httpx's HTTP/2 implementation provides any latency improvement over HTTP/1.1 implementations.
Naively constructing praw.Reddit with requestor_kwargs={"session": client} where client = Client(http2=True), I was able to run praw's quickstart example listing 10 hot submissions with the below two patches:
This is a drop-in-worthy replacement for Requests that ships with modern capabilities and allows you a painless transition.
I can answer any concerns you may have.
Describe the solution you'd like
prawcore is currently tied to
requests
and asyncprawcore toaiohttp
. I like howhttpx
has both async and sync capabilities and would like to use one HTTP library in my project as I will be calling other APIs as well. I would also like to see if httpx's HTTP/2 implementation provides any latency improvement over HTTP/1.1 implementations.httpx
is broadly compatible withrequests
but httpx.Client does not implement the exact API as requests.Session: https://www.python-httpx.org/compatibility/Naively constructing praw.Reddit with
requestor_kwargs={"session": client}
whereclient = Client(http2=True)
, I was able to run praw's quickstart example listing 10 hot submissions with the below two patches:prawcore/prawcore/auth.py
Line 51 in 16fe48c
replace with
data=data
,httpx
only supports dict syntax and not a list of tuplesprawcore/prawcore/sessions.py
Line 210 in 16fe48c
remove entirely, as httpx names the parameter differently and defaults to no redirects anyway
Describe alternatives you've considered
No response
Additional context
https://praw.slack.com/archives/CRZ00QLC9/p1681666057106319
The text was updated successfully, but these errors were encountered: