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

Caching async requests in Pytest test function

I have implemented a test function in pytest which loads data from files, casts it into Python objects and provides a new object for each test. Each one of these objects contains a request I need to make to the server and the expected responses, the…
orie
  • 541
  • 6
  • 20
0
votes
1 answer

pytest with httpx.AsyncClient cannot find newly created database records

I am trying to setup pytest with httpx.AsyncClient and sqlalchemy AsyncSession with FastAPI. Everything practically mimics the tests in FastAPI Fullstack repo, except for async stuff. No issues with CRUD unit tests. The issue arises when running…
muon
  • 12,821
  • 11
  • 69
  • 88
0
votes
0 answers

Delay between when packets returned and when asynchronous python code receives them?

I have about 130 asynchronous GET requests being sent using httpx and asyncio in python, via a proxy which I created myself on AWS. In the python script, I have printed the time just before each request is sent and can see that they are all sent…
Jonny Shanahan
  • 351
  • 3
  • 13
0
votes
0 answers

Download large files and stream them to S3?

I need to download large files and write them to S3. Instead of downloading the files to local hard drive and copy to S3, is it possible to stream the files directly to S3? I found the following code from https://www.python-httpx.org/advanced/. How…
ca9163d9
  • 27,283
  • 64
  • 210
  • 413
0
votes
1 answer

Python async iterator (httpx) and tqdm.asyncio (download progress bar)

I am using httpx as AsyncClient() (called http) and want to display the progress of a download. async with self.http.stream(method='GET', url=download_url) as res: file_out = open(file_path, 'wb') async for chunk in…
0
votes
0 answers

httpx Post Fails with Errno 32 Broken pipe

I'm trying to upload a file using httpx. This is my script: import httpx headers = { 'action': 'upload' } file = 'filename.zip' auth = httpx.DigestAuth('user', 'password') files = {'upload-file': open('files/' + file, 'rb')} with httpx.Client() as…
hugo387
  • 23
  • 3
0
votes
1 answer

What does 'RemoteProtocolError: illegal request line' mean?

I'm working on push notifications on Apple Push Notifications which uses HTTP/2 only (hence using requests is not possible) and keep getting httpx.RemoteProtocolError: illegal request line. I have no clue what this means: >>> import httpx >>>…
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
0
votes
3 answers

httpx - module 'httpcore' has no attribute 'TimeoutException'

whenever I import the module "httpx", for example in this code: import httpx input() I get this error: module 'httpcore' has no attribute 'TimeoutException' line 1, in import httpx
Takaso2
  • 47
  • 3
  • 8
0
votes
1 answer

SSL connection error when to use httpx lib

I using httpx and request some old website's xhr # ... some errors httpx.ConnectError: [SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1131) I was resolve this issue when to use requests Related How can I solve this problem in httpx? verify=False…
Atralupus
  • 131
  • 1
  • 7
0
votes
1 answer

Send mail with attachment by Mailgun API using Python's httpx library

I'm trying to send an email with an attachment using Mailgun API. I can easily achieve this using curl: curl -V -s --user 'XXX' \ https://api.eu.mailgun.net/v3/XXX/messages \ -F from='Excited User ' \ -F to='XXXX'…
kamilglod
  • 11
  • 1
  • 4
0
votes
0 answers

HTTPX Socket Connection Broken after few iteration

I'm scraping using httpx and trio, after few iteration on the link, it return an error - ReadError: socket connection broken: [WinError 10053] An established connection was aborted by the software in your host machine and this is my script: allin =…
0
votes
1 answer

RuntimeWarning: coroutine 'current_time' was never awaited return float(anyio.current_time())

python 3.8.8 httpx 0.18.2 This is my code below. I am test with httpx&asyncio.Code is very simple and same as example, but error occured. headers = {"Content-type":"text/html", "charset":"UTF-8"} async def gethtml(url): async with…
0
votes
0 answers

How can i perform request with underscore "_" in URL using httpx AsynCclient

I want to perform request via AsyncClient using httpx but URL Contains "_" Underscore and it cannot be parsed. async with self.checkoutSession: sendCheckoutResp = await self.checkoutSession.post( …
0
votes
1 answer

Why am I getting python-httpx Unclosed object warning?

What I am doing wrong? Is there a fix? I'm new to async programming; it's very confusing. # myFile.py import httpx async def ping_api(): async with httpx.AsyncClient() as client: sleep(1) print('right after with') …
0
votes
1 answer

Memory leak with async for

I have this method that gets the og:image meta tag of html pages asynchronously, I'm using httpx to stream the response so that i can stop reading when i encounter the og:image tag. My problem is that I'm getting a serious memory leak that crashes…
KiKoS
  • 428
  • 1
  • 7
  • 18
1 2 3
10
11