Questions tagged [httplib]

A module from Python standard lib that defines classes which implement the client side of the HTTP and HTTPS protocols.

Official Python documentation at http://docs.python.org/2/library/httplib.html

328 questions
2
votes
0 answers

HTTP Request/Response from a file and back

What is the best way to parse HTTP request/response from a file to some kind of standard python objects and later dump it to a file? What are the standard HTTP Request/Response objects in python. I need some kind of wrapper as output, just like…
Simon
  • 2,329
  • 4
  • 30
  • 49
2
votes
1 answer

Get response encoding using httplib/http.client

How can I get the incoming response's encoding using httplib/http.client? I can see as part of Content-Type using getheaders(), but I would guess it is bad practise to parse that since it might be in a few different formats, and you are supposed to…
2
votes
1 answer

HTTPS POST request Python, returning .csv

I want to make a post request to a HTTPS-site that should respond with a .csv file. I have this Python code: try: #conn = httplib.HTTPSConnection(host="www.site.com", port=443) => Gives an BadStatusLine: ' ' error conn =…
francisMi
  • 925
  • 3
  • 15
  • 31
2
votes
0 answers

Using heroku with python results in http:500 error

I have a python app which pulls xml data through http. I want to run this app on Heroku. The app runs fine on Heroku if I just return "hello world" without trying to pull the xml. When I run this app locally (either by using the 'foreman' command,…
Sixhobbits
  • 1,508
  • 3
  • 17
  • 26
2
votes
1 answer

SSL EOF occurred in violation of protocol with python httplib

The current questions regarding this topic didn't solve my problem and neither has Google. relevant server code: class ReuseHTTPServer(BaseHTTPServer.HTTPServer): def __init__(self, address, handler, queue=None): …
Lunchbox
  • 2,136
  • 7
  • 29
  • 40
2
votes
1 answer

httplib and HTTPs proxies

Is there a way to tunnel HTTPs requests made with python's httplib through Fiddler's proxy, without turning Fiddler into a reverse proxy? I tried using this example (from here): import httplib c =…
user1367401
  • 1,030
  • 17
  • 26
2
votes
2 answers

python unhashable type - posting xml data

First, I'm not a python programmer. I'm an old C dog that's learned new Java and PHP tricks, but python looks like a pretty cool language. I'm getting an error that I can't quite follow. The error follows the code below. import httplib, urllib url…
eterry28
  • 59
  • 5
2
votes
2 answers

httplib.HTTPSConnection timeout when connecting to Amazon Web Services

I've followed all the instructions for installing and enabling django-storages and boto in my app to upload files to S3. (As this application is intended for deployment on Heroku, I'm using virtualenv to manage dependencies.) For local development…
TAH
  • 1,658
  • 1
  • 19
  • 37
2
votes
2 answers

Python error. I don't understand what I'm doing wrong

I'm so lost as to what I'm doing wrong... I've searched the net for a few hours now, tried to reformat my code a bunch, and now I just feel stuck. This is my code: import httplib import json urlBase = 'amoeba.im' token = False username =…
Tgwizman
  • 1,469
  • 2
  • 19
  • 34
1
vote
1 answer

ApplicationError2 and ApplicationError5 when communicating with external api from AppEngine

I have built an application on google app engine, in python27 to connect with another services API and in general everything works smoothly. Every now and then I get one of the following two errors (
user714852
  • 2,054
  • 4
  • 30
  • 52
1
vote
3 answers

gai error at /home [Errno -2] Name or service not known

per the example in the httplib docs: >>> import httplib, urllib >>> params = urllib.urlencode({'@number': 12524, '@type': 'issue', '@action': 'show'}) >>> headers = {"Content-type": "application/x-www-form-urlencoded", ... "Accept":…
Colleen
  • 23,899
  • 12
  • 45
  • 75
1
vote
0 answers

Persistent HTTP connections with httplib

I'm trying to write an application where I send an initial HTTP post message to server and leave the connection open. The application then sits around until the server sends data back. Once the server sends data back I want to read it and write it…
devin
  • 6,407
  • 14
  • 48
  • 53
1
vote
1 answer

Sending mutlitple requests of httplib, raising traceback exceptions

Here is the code: conn = httplib.HTTPConnection("127.0.0.1:8000") conn.request("POST", "/api/job/", some_params, headers) conn.close() no problem with sending request to server but if i use loop for example: for i in range(n): conn =…
yernarkaz
  • 51
  • 5
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
2 answers

What is the difference between Python's httplib and urllib2?

Possible Duplicate: Python urllib vs httplib? I am just curious when I would want to use httplib over urllib2 and vice versa.
user883807