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

Python httplib websocket upgrade request

New to python and websockets but I am trying to do the following: import httplib conn = httplib.HTTPConnection('localhost:8888') conn.putheader('Connection', 'Upgrade') conn.putheader('Upgrade', 'websocket') conn.endheaders() conn.send('Hello to…
moesef
  • 4,641
  • 16
  • 51
  • 68
0
votes
0 answers

Httplib2 Grab The Source Code?

Is there any way of grabbing the html source code from here? I'm sending a post login request to a website, and if the response status is 302 I want to check the source code. I couldn't find away to do this. Here is what I have: http =…
RydallCooper
  • 19,094
  • 1
  • 11
  • 17
0
votes
2 answers

Use httplib to check if a URL will return a certain page?

Im going through several hundred bit.ly links to see if they have been used to shorten a link. If a link has not, it returns this page. How can I iterate through a list of links to check which ones do NOT return this page? I tried using the head…
Scherf
  • 1,527
  • 4
  • 16
  • 22
0
votes
1 answer

python httplib.HTTPSConnection not connected properly (to bugzilla.mozilla.org)?

i want to get information from bugzilla(bugzilla.mozilla.org) when i wrote code like below, # import httplib host = 'bugzilla.mozilla.org' h = httplib.HTTPSConnection(host) h.putrequest('GET',…
osmund sadler
  • 1,021
  • 2
  • 15
  • 27
0
votes
1 answer

python string template : Error 'must be convertible to a buffer, not Template'

I use httplib and a string template. With a normal String as message, it is working, with a template I get : Error 'must be convertible to a buffer, not Template' message=str(SMessage.substitute(... webservice = httplib.HTTP(host) …
OpenStove
  • 714
  • 1
  • 11
  • 22
0
votes
0 answers

httplib modifying my regex xml POST message

I try to make a soapclient in Python. I get an answer, but my Problem is that httplib ist converting my POST: From (.)\|WebSphere\|wast/test(.) in (.)\\|WebSphere\\|wast/test(.) What can I do for preventing the code modifying any special…
OpenStove
  • 714
  • 1
  • 11
  • 22
0
votes
1 answer

Pylons, uWSGI and httplib giving upstream prematurely closed connection error

I have a pylons app that I'm trying to run behind NGINX with uWSGI. The app makes a GET request using httplib. When testing under paster, the app receives the data from the GET request normally, but after setting it up behind uWSGI, I get the…
dwelch
  • 2,996
  • 3
  • 21
  • 13
0
votes
0 answers

Errno 104 Connection reset by peer When using python httplib2

I am making a request using httplib2 and I am getting the following errors [Errno 104] Connection reset by peer This is how I have implemented it in my code import httplib2 timeout = 60 h = httplib2.Http(".cache", timeout=timeout,…
Saad
  • 1,856
  • 1
  • 22
  • 28
0
votes
1 answer

Python JSON POST request

Different questions re: 1 script. I have to JSON-ify from a Python script that'll run on client-side and do a POST on a remote URL. I am following the docs here http://docs.python.org/2/library/httplib.html - However, I am not sure if I am doing it…
askance
  • 1,077
  • 4
  • 14
  • 19
0
votes
1 answer

Python: httplib.HTTPSConnection.request doesn't work properly

I wrote a little tool, that gathers data from facebook, using api. Tool uses multiprocessing, queues and httplib modules. Here, is a part of code: main process: def extract_and_save(args): put_queue = JoinableQueue() get_queue = Queue() …
Tural Gurbanov
  • 742
  • 2
  • 7
  • 27
0
votes
0 answers

How to solve Tweepy’s BadStatusLine error

I developed a Twitter application with Python Tweepy API. It was working well for 3 months. Yesterday it stopped working. I tried some debugs to find the problem. I noticed that if i reduced the number of words that i follow, it starts to work.…
0
votes
3 answers

Sending a POST request using httplib

I'm trying to send data using httplib. Here is my code: headers = {'User-agent': 'agent','Accept': 'application/json'} params = { 'api_key':'kjdksnjd45555','ts':455555555} data = {'job1':42,'job2':85} params['data'] = json.dumps(data,separators…
0
votes
1 answer

Python: gethostbyname error

I was coding a simple program in python that allows you to find the IP of the URL. I get this error: File "wexec.py", line 40, in hell ipname = socket.gethostbyname('http://%s' % (hcon)) socket.gaierror: [Errno 11004] getaddrinfo failed Now i'm…
Dave Stallberg
  • 1,503
  • 2
  • 13
  • 13
0
votes
0 answers

Python: Traceback namerror

Traceback : File "wexec.py", line 37, in urlopen = urllib.urlopen('%xs' % (hcon)) NameError: name 'hcon' is not defined I get this problem by doing this code in python: def hell(): hcon = raw_input(Fore.RED…
Dave Stallberg
  • 1,503
  • 2
  • 13
  • 13
0
votes
1 answer

Getting unexpected output while creating a client for Google’s Maps API using httplib module in python 2.7

import httplib try: import json except ImportError: import simplejson as json path = ('/maps/geo?q=207+N.+Defiance+St%2C+Archbold%2C+OH''&output=json&oe=utf8') connection =…
Jaassi
  • 57
  • 5