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
0 answers

how to increase speed of single http get and post requests using python httpx?

I'm trying http requests using python httpx client. the problem is every time I make requests the session object not reusing the connection. so it creating the connection every time and consuming time there and ultimately reducing the performance.…
0
votes
0 answers

Problem with local pytest run vs GitHub action pytest run of Python FastAPI code using HTTPX

I'm having problems with my unit tests that test Python FastAPI code that uses the httpx module for async HTTP calls. When I run the application in a Docker container and then run the pytests, they all pass. However, when I push the code to GitHub,…
writes_on
  • 1,735
  • 2
  • 22
  • 35
0
votes
2 answers

get server ip from response of httpx get

As the title says, if I do resp=httpx.get(url) how do I get the IP from which the url was resolved? There's This question about how to do it with requests but the same methods don't appear to exist in the httpx objects.
Dean MacGregor
  • 11,847
  • 9
  • 34
  • 72
0
votes
1 answer

SSL: CERTIFICATE_VERIFY_FAILED- Proxy Redirect - Company Network - Cacert Pem File Not Working - httpx/requests Package

Hello StackOverflow Community, I know the [SSL: CERTIFICATE_VERIFY_FAILED] error is a wildly discussed issue. However, after testing different methods such as here, here, and here, I am still not able to solve this dreadful issue. Background: While…
Vae Jiang
  • 337
  • 3
  • 8
0
votes
1 answer

How to stream upwards to an http2 POST request in Python?

I would like to stream data from a python client to an HTTP2 POST request. Meaning, streaming from the client to the server. I found an example on the httpx documentation that shows how to stream from a response. I would like to do the opposite,…
Tom Klino
  • 2,358
  • 5
  • 35
  • 60
0
votes
1 answer

oauth 1 not working with httpx and authlib

i am currently making oauth 1 signed requests using the requests-oauthlib library. from requests_oauthlib import OAuth1Session self.session = OAuth1Session( OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, oauth_token, oauth_token_secret, …
woldgrep
  • 97
  • 2
  • 12
0
votes
0 answers

How to use asyncio.semapahore in FastAPI?

I am building a FastAPI server for an image classification model. The API takes in image urls and downloads them concurrently using httpx. I want to limit the number of concurrent downloads across the server using asyncio.Semaphores. I tried…
0
votes
1 answer
0
votes
1 answer

httpx AsyncClient -missing method prepare_request

I am trying to port the "Prepared Request" example from this link: https://docs.python-requests.org/en/latest/user/advanced/ using httpx AsnycClient. from requests import Request, Session s = Session() req = Request('GET', url, data=data,…
stev
  • 83
  • 1
  • 8
0
votes
1 answer

HTTP request with browser "redirects" request without 302, but with Python Request library it 404's

I'm trying to fetch a page made with react with Python's request.get that returns 404. import requests page=requests.get("https://example.com/foo", allow_redirects=True) print(page.status_code) results in 404.…
Lucky
  • 627
  • 5
  • 15
0
votes
1 answer

can connect to URL with curl but not with requests (i.e. requests ignoring my CA bundle?)

I am able to connect to a certain URL with cURL, after I installed the corresponding SSL certificates: $ export MY_URL=https://www.infosubvenciones.es/bdnstrans/GE/es/convocatoria/616783 $ curl -vvvv $MY_URL # Fails $ sudo openssl x509 -inform pem…
astrojuanlu
  • 6,744
  • 8
  • 45
  • 105
0
votes
1 answer

Fast API with pytest using AsyncClient gives 422 on post?

I'm trying to send a request to an api using pytest through httpx.AsynClient @pytest.mark.anyio async def test_device_create_with_data(self, client, random_uuid): device_create = DeviceCreateFactory.build(subId=random_uuid) json =…
0
votes
2 answers

Python parsing the site gives

There is a website that I need to analyze However, when I try to analyze it, I get the response Tried to change the useragent, cookie, doesn't help. from bs4 import BeautifulSoup import httpx response =…
Alena
  • 11
  • 2
0
votes
1 answer

Python Httpx lib error: h11._util.RemoteProtocolError: can't handle event type ConnectionClosed when role=SERVER and state=SEND_RESPONSE

Hello guys i am trying to send a request in Python using with httpx.Client(cookies=cookies, headers=headers, proxies="http://username:password@ip:port", timeout=30) as client: But it is giving me the following error h11._util.RemoteProtocolError:…
0
votes
0 answers

Unable to figure out the post request parameter

I'm trying to query the following website By choosing the advanced search as below and query that pattern QW=部队 I noticed an XHR request to the following endPoint I think that the query pattern QW=部队 encoded within SearchStateJson but I've no clue…