httplib2

Python httplib2, AttributeError: 'set' object has no attribute 'items'

江枫思渺然 提交于 2019-12-05 06:47:32
I'm playing with the Python library httplib2 . The following is my code. import urllib.parse import httplib2 httplib2.debuglevel = 1 http = httplib2.Http() url = "http://login.sina.com.cn/hd/signin.php" body = {"act": "1", "entry": "vblog", "password": "P@$sW0rd", "reference": "http://vupload.you.video.sina.com.cn/u.php?m=1&cate=0", "reg_entry": "vblog", "remLoginName": "on", "username": "this_is_user_name", "x": "", "y": ""} headers = {"Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7", "Accept-Encoding", "gzip

ImportError: No module named httplib2

旧街凉风 提交于 2019-12-05 04:23:52
I have a Python 2.7 GAE app that already has a lot of functionality. Now I want to integrate with a Google API. Within my IDE (PyCharm) running on Mac OSX, I added the following lines to my app's main program: import httplib2 pass When I COMMAND-click "httplib2", the IDE opens "httplib2-0.8-py2.7.egg/httplib2/ init.py " in an editor panel, so the IDE apparently knows where httplib2 is. But running the app, I get the error shown in the title. To test further, I put breakpoints on both statements shown above and then run the app in debug mode. When it gets to the import statement, I immediately

pyinstaller compiled file has ssl issue, error: 185090050

大兔子大兔子 提交于 2019-12-04 15:33:36
i've got some python code that's successfully running on my windows machine in the python ide and cmd prompt. after i compile with pyinstaller (into one file) i get the following error: Traceback <most recent call last>: File "<string>", line 51, in <module> File "build\bdist.win32\egg\oauth2\__init__.py", line 682, in request ... ((traceback through httplib2 and then ssl)) ssl.SSLError: [Errno 185090050] _ssl.c:340: error:0B084002:x509 certificates routines:X509_load_cert_crl_file:system lib a subset of my code that's causing the error is as follows: import oauth2 as oauth import httplib2

httplib2, how to set more than one cookie?

孤街醉人 提交于 2019-12-04 06:51:23
As you are probably aware, more often than not, an HTTP server will send more than just a session_id cookie; however, httplib2 handles cookies with a dictionary, like this: response, content = http.request(url, 'GET', headers=headers) headers = {'Cookie': response['set-cookie']} url = 'http://www.example.com/home' response, content = http.request(url, 'GET', headers=headers) So, how do I set the extra cookies? If handled with a dictionary, I can't have double Cookie keys :S. Thanks for your time. Cookies are contained in a single HTTP header, separated by semicolons. Example: cookie1=value1

How to do mutual certificate authentication with httplib2

孤人 提交于 2019-12-03 06:43:29
I'm using httplib2 to make a request from my server to another web service. We want to use mutual certificate authentication. I see how to use a certificate for the outgoing connection ( h.set_certificate ), but how do I check the certificate used by the answering server? This ticket seems to indicate that httplib2 doesn't do it itself, and has only vague suggestions about where to look. Is it possible? Am I going to have to hack at a lower level? Here's the code my co-worker Dave St. Germain wrote to solve the problem: import ssl import socket from httplib2 import has_timeout import httplib2

Python httplib2 Handling Exceptions

最后都变了- 提交于 2019-12-03 03:39:55
I have this very simple code to check if a site is up or down. import httplib2 h = httplib2.Http() response, content = h.request("http://www.folksdhhkjd.com") if response.status == 200: print "Site is Up" else: print "Site is down" When I enter a valid URL then it properly prints Site is Up because the status is 200 as expected. But, when I enter an invalid URL, should it not print Site is down? Instead it prints an exception something like this Traceback (most recent call last): File "C:\Documents and Settings\kripya\Desktop\1.py", line 3, in <module> response, content = h.request("http://www

HTTP Requests using a range of IP address on python

落花浮王杯 提交于 2019-12-02 22:34:40
问题 I have a VM as a server with IP address 10.91.55.2. I have another VM which acts as a client having IP address in the range 10.91.56.2......10.91.56.10. I want to write a script that will use all these IP address on the client to send HTTP request to the server (10.91.55.2). I have written a script that sends HTTP requests using the Physical IP address alone. Is there any way to send HTTP Requests from a range of IP address. My OS Is linux. 回答1: This is not a complete answer, but should

HTTP Requests using a range of IP address on python

∥☆過路亽.° 提交于 2019-12-02 13:02:09
I have a VM as a server with IP address 10.91.55.2. I have another VM which acts as a client having IP address in the range 10.91.56.2......10.91.56.10. I want to write a script that will use all these IP address on the client to send HTTP request to the server (10.91.55.2). I have written a script that sends HTTP requests using the Physical IP address alone. Is there any way to send HTTP Requests from a range of IP address. My OS Is linux. Peter Gibson This is not a complete answer, but should provide you with a starting point. You say "I have another VM which acts as a client", so I'll

SSL version in httplib2 - EOF occurred in violation of protocol

好久不见. 提交于 2019-12-01 05:22:26
问题 I'm issuing a HTTPS GET request to a REST service I own with httplib2 but we're getting the error: [Errno 8] _ssl.c:504: EOF occurred in violation of protocol All other clients works well (browser, Java client, etc...) with the minor exception that PHP curl needed to be set to use SSL v3. I've searched around and it seems that it is indeed an error regarding SSL version, but I can't seem to find a way to change it in httplib2. Is there any way around it besides changing the following line in

Using Httplib2 on Python Appengine

狂风中的少年 提交于 2019-11-30 18:11:23
Why am I getting this error when running my application which is trying to OAuth with Foursquare? import httplib2 ImportError: No module named httplib2 I have installed httplib2 by downloading it and $ python setup.py install on the command line as instructed here Am I missing something? Thanks You will need to include the library in your project so that the App Engine runtime knows what you're importing. From here : You can include other pure Python libraries with your application by putting the code in your application directory. If you make a symbolic link to a module's directory in your