pycurl

Problem trying to install PyCurl on Mac Snow Leopard

送分小仙女□ 提交于 2019-12-03 16:08:33
My app needs to use PyCurl, so I tried to install it on my Mac but I found a lot of problems and errors. Requirement: First of all I have to say that the version of Python working on my Mac is 32 bit based, because I need to use WxPython, that needs 32 bit Python. For doing this I used: defaults write com.apple.versioner.python Prefer-32-Bit -bool yes To install PyCurl I used: sudo env ARCHFLAGS="-arch x86_64" easy_install setuptools pycurl And the terminal returned: Best match: setuptools 0.6c11 Processing setuptools-0.6c11-py2.6.egg setuptools 0.6c11 is already the active version in easy

Getting HTML with Pycurl

柔情痞子 提交于 2019-12-03 12:34:28
问题 I've been trying to retrieve a page of HTML using pycurl, so I can then parse it for relevant information using str.split and some for loops. I know Pycurl retrieves the HTML, since it prints it to the terminal, however, if I try to do something like html = str(c.perform()) The variable will just hold a string which says "None". How can I use pycurl to get the html, or redirect whatever it sends to the console so it can be used as a string as described above? Thanks a lot to anyone who has

SSL error installing pycurl after SSL is set

跟風遠走 提交于 2019-12-03 10:41:48
Just some information to start: I'm running Mac OS 10.7.5 I have curl 7.21.4 installed (came with dev tools I believe) I have python 2.7.1 I've been trying to get pycurl installed, but every time I try to run it, I get: ImportError: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (none/other) I first installed pycurl using the setup: python setup.py install Which didn't work (since SSL wasn't configured). I have since uninstalled pycurl ( sudo rm -rf /Library/Python/2.7/site-packages/pycurl* ) before attempting: export PYCURL_SSL_LIBRARY=openssl easy

Error installing PyCurl

别说谁变了你拦得住时间么 提交于 2019-12-03 07:48:34
I tried installing pycurl via pip. it didn't work and instead it gives me this error. running install running build running build_py running build_ext building 'pycurl' extension gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -DHAVE_CURL_SSL=1 -I/System/Library/Frameworks/ Python.framework/Versions/2.6/include/python2.6 -c src/pycurl.c -o build/temp.macosx-10.6-universal-2.6/src/pycurl.o src/pycurl.c:85:4: warning: #warning "libcurl was compiled with SSL support, but configure could not

How to read the header with pycurl

别说谁变了你拦得住时间么 提交于 2019-12-03 06:45:53
问题 How do I read the response headers returned from a PyCurl request? 回答1: There are several solutions (by default, they are dropped). Here is an example using the option HEADERFUNCTION which lets you indicate a function to handle them. Other solutions are options WRITEHEADER (not compatible with WRITEFUNCTION) or setting HEADER to True so that they are transmitted with the body. #!/usr/bin/python import pycurl import sys class Storage: def __init__(self): self.contents = '' self.line = 0 def

pycurl and SSL cert

你离开我真会死。 提交于 2019-12-03 06:42:25
问题 I am trying to write a pycurl script to access a secured site (HTTPS). c = pycurl.Curl() c.setopt(pycurl.USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0') c.setopt(pycurl.URL, 'https://for-example-securedsite') c.setopt(pycurl.COOKIEFILE, 'cookie.txt') c.setopt(pycurl.COOKIEJAR, 'cookies.txt') c.setopt(pycurl.WRITEDATA, file("page.html","wb")) I am getting the below error.. pycurl.error: (60, 'SSL certificate problem, verify that the CA cert is OK. Details:

pycurl installation on Windows

好久不见. 提交于 2019-12-03 05:11:45
问题 I am not able to install pycurl on Windows on Python2.6. Getting following error: C:\Documents and Settings\vijayendra\Desktop\Downloads\pycurl-7.19.0>python setup.py install --curl-dir="C:\Documents and Settings\vijayendra\Desktop\Downloads\ curl-7.19.5-win32-ssl\curl-7.19.5" Using curl directory: C:\Documents and Settings\vijayendra\Desktop\Downloads\curl-7.19.5-win32-ssl\curl-7.19.5 Traceback (most recent call last): File "setup.py", line 210, in <module> assert os.path.isfile(o), o

Custom headers with pycurl

那年仲夏 提交于 2019-12-03 04:41:37
Can I send a custom header like "yaddayadda" to the server with the pycurl request? I would code something like: pycurl_connect = pycurl.Curl() pycurl_connect.setopt(pycurl.URL, your_url) pycurl_connect.setopt(pycurl.HTTPHEADER, ['header_name1: header_value1', 'header_name2: header_value2']) pycurl_connect.perform() you can, with HTTPHEADER. just provide your custom headers as a list, like so: header = ['test: yadayadayada', 'blahblahblah'] curl.setopt(pycurl.HTTPHEADER, header) Try to use human_curl library https://github.com/Lispython/human_curl custom_headers = ( ('Test-Header',

pycurl equivalent of “curl --data-binary”

匿名 (未验证) 提交于 2019-12-03 03:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'd like to know the equivalent of this curl command in pycurl: curl --data-binary @binary_data_file.bin 'http://server/myapp/method' Note: The above curl statement uses the POST method. I need to use this for compatibility with my server script. 回答1: The requests library is meant to keep things like this simple: import requests r = requests.post('http://server/myapp/method', data={'aaa': 'bbb'}) Or depending on how the receiving end expects data: import requests r = requests.post('http://server/myapp/method', data=file('binary_data_file.bin

Getting HTML with Pycurl

陌路散爱 提交于 2019-12-03 03:05:50
I've been trying to retrieve a page of HTML using pycurl, so I can then parse it for relevant information using str.split and some for loops. I know Pycurl retrieves the HTML, since it prints it to the terminal, however, if I try to do something like html = str(c.perform()) The variable will just hold a string which says "None". How can I use pycurl to get the html, or redirect whatever it sends to the console so it can be used as a string as described above? Thanks a lot to anyone who has any suggestions! this will send a request and store/print the response body: from StringIO import