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
325
votes
7 answers

How to send POST request?

I found this script online: import httplib, urllib params = urllib.urlencode({'number': 12524, 'type': 'issue', 'action': 'show'}) headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"} conn =…
user1113569
  • 3,441
  • 2
  • 14
  • 10
77
votes
3 answers

Proxying to another web service with Flask

I want to proxy requests made to my Flask app to another web service running locally on the machine. I'd rather use Flask for this than our higher-level nginx instance so that we can reuse our existing authentication system built into our app. The…
Joe Shaw
  • 22,066
  • 16
  • 70
  • 92
71
votes
8 answers

Python-Requests close http connection

I was wondering, how do you close a connection with Requests (python-requests.org)? With httplib it's HTTPConnection.close(), but how do I do the same with Requests? Code: r = requests.post("https://stream.twitter.com/1/statuses/filter.json",…
user179169
57
votes
6 answers

Python urllib vs httplib?

When would someone use httplib and when urllib? What are the differences? I think I ready urllib uses httplib, I am planning to make an app that will need to make http request and so far I only used httplib.HTTPConnection in python for requests, and…
jahmax
  • 8,181
  • 7
  • 26
  • 25
50
votes
8 answers

HTTPS connection Python

I am trying to verify the that target exposes a https web service. I have code to connect via HTTP but I am not sure how to connect via HTTPS. I have read you use SSL but I have also read that it did not support certificate errors. The code I have…
chrisg
  • 40,337
  • 38
  • 86
  • 107
45
votes
6 answers

Python httplib ResponseNotReady

I'm writing a REST client for elgg using python, and even when the request succeeds, I get this in response: Traceback (most recent call last): File "testclient.py", line 94, in result = sendMessage(token, h1) File "testclient.py",…
directedition
  • 11,145
  • 18
  • 58
  • 79
44
votes
10 answers

error: can't start new thread

I have a site that runs with follow configuration: Django + mod-wsgi + apache In one of user's request, I send another HTTP request to another service, and solve this by httplib library of python. But sometimes this service don't get answer too…
Oduvan
  • 2,607
  • 3
  • 24
  • 24
34
votes
3 answers

How do I get the IP address from a http request using the requests library?

I am making HTTP requests using the requests library in python, but I need the IP address from the server that responded to the HTTP request and I'm trying to avoid making two calls (and possibly having a different IP address from the one that…
gawry
  • 762
  • 1
  • 9
  • 18
26
votes
3 answers

IncompleteRead using httplib

I have been having a persistent problem getting an rss feed from a particular website. I wound up writing a rather ugly procedure to perform this function, but I am curious why this happens and whether any higher level interfaces handle this…
umeboshi
  • 767
  • 1
  • 6
  • 12
24
votes
1 answer

How to send and receive HTTP POST requests in Python

I need a simple Client-side method that can send a boolean value in a HTTP POST request, and a Server-side function that listens out for, and can save the POST content as a var. I am having trouble finding information on how to use the…
Idan S
  • 241
  • 1
  • 3
  • 6
21
votes
2 answers

Permanent 'Temporary failure in name resolution' after running for a number of hours

After running for a number of hours on Linux, my Python 2.6 program that uses urllib2, httplib and threads, starts raising this error for every request: URLError(gaierror(-3, 'Temporary failure in name resolution'),) If I…
2371
  • 957
  • 1
  • 6
  • 19
21
votes
4 answers

How do I make a PATCH request in Python?

Is there a way to make a request using the PATCH HTTP method in Python? I tried using httplib, but it doesn't accept PATCH as method param.
Ricardo Augusto
  • 548
  • 1
  • 8
  • 18
21
votes
2 answers

How do I have python httplib accept untrusted certs?

How do I have python httplib accept untrusted certs? I created a snake oil/self signed cert on my webserver, and my python client fails to connect as I am using a untrusted cert. I'd rather problematically fix this in my client code rather than…
Kladskull
  • 10,332
  • 20
  • 69
  • 111
20
votes
1 answer

Are urllib2 and httplib thread safe?

I'm looking for information on thread safety of urllib2 and httplib. The official documentation (http://docs.python.org/library/urllib2.html and http://docs.python.org/library/httplib.html) lacks any information on this subject; the word thread is…
Piotr Dobrogost
  • 41,292
  • 40
  • 236
  • 366
20
votes
2 answers

How do I use Python's httplib to send a POST to a URL, with a dictionary of parameters?

I just want a function that can take 2 parameters: the URL to POST to a dictionary of parameters How can this be done with httplib? thanks.
TIMEX
  • 259,804
  • 351
  • 777
  • 1,080
1
2 3
21 22