Questions tagged [http.client]
97 questions
6
votes
2 answers
How can I read exactly one response chunk with python's http.client?
Using http.client in Python 3.3+ (or any other builtin python HTTP client library), how can I read a chunked HTTP response exactly one HTTP chunk at a time?
I'm extending an existing test fixture (written in python using http.client) for a server…

Ben Burns
- 14,978
- 4
- 35
- 56
5
votes
2 answers
Decompressing (Gzip) chunks of response from http.client call
I have the following code that I am using to try to chunk response from a http.client.HTTPSConnection get request to an API (please note that the response is gzip encoded:
connection = http.client.HTTPSConnection(api, context =…

qwerty
- 887
- 11
- 33
4
votes
1 answer
http.client.IncompleteRead error in Python3
I'm trying to scrape a really long web page with beautifulsoup4 and python3. Due to the size of the website, http.client throws me an error when I try to search for something in the website:
File "/anaconda3/lib/python3.6/http/client.py", line 456,…

Evan Hsueh
- 139
- 1
- 2
- 9
4
votes
0 answers
Follow redirect using http.client
Is there a way to automatically follow redirects using the http.client module:
def grab_url(host, path = '/'):
class Data: pass
result = Data()
try:
con = http.client.HTTPConnection(host)
con.request('GET', path)
response =…

Cyclonecode
- 29,115
- 11
- 72
- 93
3
votes
1 answer
http.client.ResponseNotReady: Idle
I'm trying to learn how to code with http.client but a simple code ends in this error and I don't know what to do.
import http.client
conn=http.client.HTTPSConnection('www.google.com')
res=conn.getresponse()
print(res.status,res.reason)
and the…

peiman razavi
- 102
- 1
- 6
3
votes
1 answer
Login to website using http.client
I am trying to login to a website using http.client in Python using the following code:
import urllib.parse
import http.client
payload = urllib.parse.urlencode({"username": "USERNAME-HERE",
"password":…

Den Dinh
- 197
- 1
- 10
3
votes
2 answers
Example of including a certficate in a post request with python and http.client
I am trying to POST xml to a site using python. I have to include a certificate but am unsure of how to do this. Is it enough to specify the file path of the certificate locally on my computer?
Can anybody show my an example of how to include the…

dagrun
- 621
- 3
- 11
- 29
2
votes
0 answers
http.client returning 502 bad gateway error
I'm trying to send a post request to https://trades.roblox.com/v1/trades/send using proxies. These proxies use user:pass authorization. However, I get a 503 bad gateway error when sending the post request.
Here is my code:
import base64
proxies =…

stick
- 21
- 3
2
votes
0 answers
Python - http.client.HTTPSConnection - ashx return empty
Can someone please help with http.client.HTTPSConnection please?
I completly did not understand why response return : b''
If i use connection.request('GET', url='/') page returns correctly
import http.client
connection =…

IlyaK
- 25
- 1
- 4
2
votes
1 answer
Create a broken form with http.Client
How to create a 'broken' form for testing purposes with http.Client that will trigger a response error on ParseForm() in a handler function?
I have the following code:
func (app *App) signupUser(w http.ResponseWriter, r *http.Request) {
err :=…

IvanD
- 2,728
- 14
- 26
2
votes
1 answer
http.client.HTTPConnection.request vs. urllib.request.Request
urllib.request and http.client are both python standard libraries. The docs for the relevant method from the former is here and the latter, here (am using 3.5)
Does anyone know why they have 2 methods within the standard libraries which appear to do…

cardamom
- 6,873
- 11
- 48
- 102
2
votes
2 answers
How to do PUT request in Python for loop
I'm trying to crawl a website to get the info about vehicles. I want to get all vehicles from that site. I want to repeat the process every day because every day there are new vehicles.
There are a lot of cars, more than 100 thousand. Thus doing it…

Boky
- 11,554
- 28
- 93
- 163
2
votes
0 answers
source address with requests or urllib module
Presently I am using http.client module to download files from my apache server. I want to know if there is a way to replace this set of code with requests or urllib module.
con =…

Ritika
- 21
- 1
2
votes
1 answer
python3 http.client i cant use for not www sites
I want to check this site is online or not.
import http.client
c = http.client.HTTPConnection("https://support.binance.com/hc/en-us/categories/115000056351")
c.request("HEAD", "/index.html")
print (c.getresponse().status)
Code is working for
c =…

Kağan Örün
- 23
- 3
2
votes
1 answer
Using http.client in Python3.6 returns [SSL: UNKNOWN_PROTOCOL]
The script has quite a simple purpose of checking if a series of websites are up and running. I tried with urllib but I get a certificate error.
Using http.client and tunneling via proxy seems to return a weird output up until a website were it…

Robert
- 521
- 2
- 8
- 14