pycurl

pycurl

pycurlを使ってみた

install

$ pip install pycurl
Downloading/unpacking pycurl
  Downloading pycurl-7.19.0.2.tar.gz (89kB): 89kB downloaded
  Running setup.py egg_info for package pycurl
    Using curl-config (libcurl 7.24.0)

Installing collected packages: pycurl
  Running setup.py install for pycurl
    Using curl-config (libcurl 7.24.0)
    building 'pycurl' extension
    /usr/bin/clang -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CURL_SSL=1 -I.pyenv/versions/2.7.5/include/python2.7 -c src/pycurl.c -o build/temp.macosx-10.4-x86_64-2.7/src/pycurl.o
    src/pycurl.c:106:4: warning: "libcurl was compiled with SSL support, but configure could not determine which "    "library was used; thus no SSL crypto locking callbacks will be set, which may "    "cause random crashes on SSL requests" [-W#warnings]
    #  warning \
       ^
    1 warning generated.
    /usr/bin/clang -bundle -undefined dynamic_lookup -L.pyenv/versions/2.7.5/lib build/temp.macosx-10.4-x86_64-2.7/src/pycurl.o -lcurl -o build/lib.macosx-10.4-x86_64-2.7/pycurl.so

Successfully installed pycurl
Cleaning up...
$

versionを確認してみた

>>> pycurl.version
'libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5'
>>> pycurl.version_info()
(3, '7.24.0', 464896, 'x86_64-apple-darwin12.0', 33469, 'OpenSSL/0.9.8r', 0, '1.2.5', ('dict', 'file', 'ftp', 'ftps', 'gopher', 'http', 'https', 'imap', 'imaps', 'ldap', 'ldaps', 'pop3', 'pop3s', 'rtsp', 'smtp', 'smtps', 'telnet', 'tftp'), None, 0, None)
>>>

普通にGETしてみた

>>> curl = pycurl.Curl()
>>> curl.setopt(pycurl.URL, 'http://sximadaw3.web.fc2.com/')
>>> curl.setopt(pycurl.FOLLOWLOCATION, 1)
>>> curl.getinfo(pycurl.HTTP_CODE)
>>> curl.perform()
>>> curl.getinfo(pycurl.HTTP_CODE)
200
>>> curl.getinfo(pycurl.EFFECTIVE_URL)
'http://sximadaw3.web.fc2.com/'

目次

前のトピックへ

PyCrypto - 暗号化モジュール

次のトピックへ

pyftpdlib

このページ

inserted by FC2 system