Questions tagged [httpx]

HTTPX is a fully featured HTTP client for Python 3, which provides sync and async APIs, and support for both HTTP/1.1 and HTTP/2.

HTTPX is a fully featured HTTP client for Python 3, which provides sync and async APIs, and support for both HTTP/1.1 and HTTP/2. For more details, please check the HTTPX website.

162 questions
0
votes
1 answer

Handle Request payload using HTTPX for post data and capcha key to google recapchaV2

I'm trying to send the key I got from anti captcha, an example of the key is like this { "errorId":0, "status":"ready", "solution": { "gRecaptchaResponse":"3AHJ_VuvYIBNBW5yyv0zRYJ75VkOKvhKj9_xGBJKnQimF72rfoq3Iy-DyGHMwLAo6a3" …
perymerdeka
  • 766
  • 9
  • 19
0
votes
0 answers

Python-Authlib: setting an Oauth2 Async client with (service principal) and (user, password)

I come here for help after being stuck a few hours creating an OAuth2 Async httpx client. It's one of those situations that feels so close, and still doesn't come through in the end. I'm using this oauth2 session/client documentation: What I…
Diego-MX
  • 2,279
  • 2
  • 20
  • 35
0
votes
0 answers

How to write unit test case for fastapi for mysql

app.py def get_db(request: Request): return request.state.db @router.get("/data") async def endpoint( db:Session = Depends(get_db), ): try: data = await crud.get_all_data(db=db) return data test_main.py def…
putta
  • 35
  • 8
0
votes
1 answer

Scrape website using httpx and requests returns a timeout

I am trying to scrape this…
Hal
  • 193
  • 1
  • 9
0
votes
0 answers

Why is the response sometimes passing through and sometimes not when using requests httpx in python?

I am trying to scrape this website items, however when I used httpx or even requests sometimes it passes and gets the response sometimes it doesn't. It seems random, that's why I tried doing a rerun of the failed items to get the results. However…
Hal
  • 193
  • 1
  • 9
0
votes
1 answer

How to prevent httpx timeout in python?

I am trying to scrape tokopedia here. When I use raw codes, it works and the json is returned. However when I tried to use it as a variable, it reads time…
Hal
  • 193
  • 1
  • 9
0
votes
1 answer

HTTPX | Requests Proxies Setup

I am trying to use Proxies for my WebScraping Project, which i did build with HTTPX. However when i was setting up my proxies i still got blocked, so i tryed out if the actully work/get used. I bought some proxys from an professional website/seller,…
MrRementer
  • 21
  • 3
0
votes
0 answers

playwright and httpx coroutine conflicts,How to solve it?

I created a BaseSpider class that needs to use playwright and httpx, but in the case of coroutines, they conflict. code: class BaseSpider(): def __init__(self) : self.play_wright = sync_playwright().start() async def req(self,…
LiLin
  • 1
  • 1
0
votes
0 answers

how to mobile scrape get app client token using python?

I tried to scrape a mobile app happyfresh (indonesia based) here's a link to the app that has been mitm'ed https://drive.google.com/file/d/1EB0JfZiI1ADQkDj-Y2OgKAzIDVcYQHgk/view?usp=sharing I can't get the first instance of url that's being fired to…
Hal
  • 193
  • 1
  • 9
0
votes
1 answer

Python3.8 asyncio: RuntimeWarning: coroutine was never awaited

I am new with async functions and i'm trying to make multiple calls from an external API. concurrent.Futures is not quite enough to retrieve the responses so i tried with asyncio and httpx but the process is throwing an error unknown and difficult…
bittrago
  • 31
  • 1
  • 6
0
votes
0 answers

How to transfer Selenium session to the requests one and quit the selenium?

Okay, so what if the site I need to authorize in doesn't support direct login since the api is closed and it's very complicated. So I need to use Selenium for logging into the session, but then somehow transfer it to the, for example, httpx…
0
votes
1 answer

httpx.RemoteProtocolError: peer closed connection without sending complete message body

I am getting the above error despite setting the timeout to None for the httpx call. I am not sure what I am doing wrong. from httpx import stream with stream("GET", url, params=url_parameters, headers=headers, timeout=None) as streamed_response:
Paul Bradbury
  • 85
  • 2
  • 10
0
votes
1 answer

Memory not being released by httpx

So I've been struggling to find a solution here that doesn't require me ripping out httpx and replacing it with another library, especially since the availability of http2/async libraries is slim to none. While I wait for the team at httpx to get…
splotsh
  • 53
  • 1
  • 8
0
votes
2 answers

Why does asyncio.create_task and asyncio.ensure_future behave differently when creating httpx tasks for gather?

I found an async httpx example where ensure_future works but create_task doesn't, but I can't figure out why. As I've understood that create_task is the preferred approach, I'm wondering what's happening and how I may solve the problem. I've been…
0
votes
1 answer

Merge dict header to request.headers.raw

headers.raw is typing.List[typing.Tuple[bytes, bytes]] I want to merge it into another dict, like the one below: client.build_request(headers=dict(request.headers.raw) | {"foo": "bar"}), However I got the error expected "Union[Headers, Dict[str,…
Rodrigo
  • 135
  • 4
  • 45
  • 107