Questions tagged [http.client]

97 questions
2
votes
1 answer

How to convert to bytes when TypeError: can't concat bytes to str

I am trying to send data via an API but am getting the TypeError: can't concat bytes to str. This I understand means I need to convert part of my code to bytes but I am unsure how to do this. I've tried adding b in front or using bytes('data') but…
nvachhan
  • 93
  • 3
  • 9
2
votes
2 answers

How to upload a binary/video file using Python http.client PUT method?

I am communicating with an API using HTTP.client in Python 3.6.2. In order to upload a file it requires a three stage process. I have managed to talk successfully using POST methods and the server returns data as I expect. However, the stage that…
yekootmada
  • 21
  • 3
  • 8
2
votes
1 answer

python3 http.client ssl certification error

using python3 and geting the following error ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749) what am i missing can someone help me with this import http.client conn =…
Pbch
  • 179
  • 2
  • 4
  • 12
2
votes
1 answer

Query Request from Haskell with two times the "same data"

I'm try to make a Http request with Haskell (Aeson) to Elasticsearch. The Elasticsearch body looks so: { "query": { "function_score": { "query": { "bool": { "should": [ …
Chuck Aguilar
  • 1,998
  • 1
  • 27
  • 50
2
votes
2 answers

How to handle IncompleteRead: in biopython

I am trying to fetch fasta sequences for accession numbers from NCBI using Biopython. Usually the sequences were successfully downloaded. But once in a while I get the below error: http.client.IncompleteRead: IncompleteRead(61808640 bytes read) I…
catuf
  • 381
  • 3
  • 13
2
votes
2 answers

Is it precise to use `requests` to check if a domain name is registered?

I noticed that requesting an invalid url requests.get(invalid_url) throws the following exceptions: Traceback (most recent call last): File "/usr/lib/python3.4/socket.py", line 530, in getaddrinfo for res in _socket.getaddrinfo(host, port,…
SparkAndShine
  • 17,001
  • 22
  • 90
  • 134
1
vote
1 answer

Using http.Client in Http Middleware causes the original HttpRequest.Body to be in a closed state

When I use the GoLand tool for debugging,After using HttpClient to request an address in Middleware, the status of the original r *http.Request.Body becomes closed, resulting in an exception during parsing in the Handler: error: http: invalid Read…
nil
  • 59
  • 4
1
vote
1 answer

http.Transport -> WriteBufferSize & ReadBufferSize not working for http2

I am trying to increase the write buffers of my http2 client, but it is not working. I am setting it like below (at client side): httpTransport := &http.Transport { WriteBufferSize: 83000000, ReadBufferSize: 83000000, } …
Singh
  • 11
  • 1
1
vote
1 answer

How to check if a release exists on a GitLab repo

I have a repo in GitLab and now I need to check if a release based on a tag exists using Python. I have tried below Python code but I always get the response "301 Moved Permanently" independently if release exsits or not. I am using Http Client…
Willy
  • 9,848
  • 22
  • 141
  • 284
1
vote
0 answers

How to fix "hostname mismatch" error when connecting using http.client.HTTPSConnection?

I have a Python program which makes requests using httplib/http.client. It works beautifully in Python 2.7. Both Python2 and Python3 work 100% of the time with http. However, the program fails for some of our named servers using https from…
1
vote
0 answers

How to test python's http.client.HTTPResponse?

I'm trying to work with a third party API and I am having problems with sending the request when using the requests or even urllib.request. Somehow when I use http.client I am successful sending and receiving the response I need. To make life easier…
1
vote
0 answers

TypeError: can't concat bytes to str in HTTP Connection

I am trying to connect to an API by using the code they have provided in the documentation. However, during the authorization request, I get the TypeError: can't concat str to bytes. I have searched through stack overflow but most of the problems…
csgzdnes
  • 11
  • 2
1
vote
1 answer

Python Auth0: Unable to get user information via Management API V2 by user ID

I get the Auth0 management access token by: conn = http.client.HTTPSConnection("{env.get("AUTH0_DOMAIN")}") payload =…
1
vote
1 answer

Python http.client giving empty string when I use response.read().decode()

I am using http.client to hit a POST api and get the json response. My code is working correctly when I print response.read(). However, for some reason, this response is limited to only 20 results and the total count of results is over 20,000. I…
Mohammad Haris
  • 111
  • 1
  • 1
  • 8
1
vote
0 answers

In a Golang RoundTripper can I read a response Header?

I'm using Envoy as mTLS proxies on load-balanced servers. The Go client makes an HTTPS call to the load balancer which responds with a redirect to another server. I need to modify the port number in the response to use the Envoy port. Is it possible…
Zaphod
  • 241
  • 2
  • 9