Python pycurl 模块,SSLKEY 实例源码

我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用pycurl.SSLKEY

项目:GOKU    作者:bingweichen    | 项目源码 | 文件源码
def postXmlSSL(self, xml, url, second=30, cert=True, post=True):
        """????"""
        self.curl.setopt(pycurl.URL, url)
        self.curl.setopt(pycurl.TIMEOUT, second)
        # ????
        # ?????cert ? key ??????.pem??
        # ?????PEM?????
        if cert:
            self.curl.setopt(pycurl.SSLKEYTYPE, "PEM")
            self.curl.setopt(pycurl.SSLKEY, WxPayConf_pub.SSLKEY_PATH)
            self.curl.setopt(pycurl.SSLCERTTYPE, "PEM")
            self.curl.setopt(pycurl.SSLCERT, WxPayConf_pub.SSLCERT_PATH)
        # post????
        if post:
            self.curl.setopt(pycurl.POST, True)
            self.curl.setopt(pycurl.POSTFIELDS, xml)
        buff = StringIO()
        self.curl.setopt(pycurl.WRITEFUNCTION, buff.write)

        self.curl.perform()
        return buff.getvalue()
项目:xtdpy    作者:psycofdj    | 项目源码 | 文件源码
def enable_tls(self, p_cacert, p_cert, p_key):
    self.m_handle.setopt(pycurl.CAINFO,         p_cacert)
    self.m_handle.setopt(pycurl.SSLCERT,        p_cert)
    self.m_handle.setopt(pycurl.SSLKEY,         p_key)
    self.m_handle.setopt(pycurl.SSL_VERIFYPEER, True)
项目:lpc-scripts    作者:FNALLPC    | 项目源码 | 文件源码
def getCurlInfo(url):
    buffer = StringIO()
    c = pycurl.Curl()
    c.setopt(c.URL, url)
    c.setopt(pycurl.SSL_VERIFYPEER, 1)
    c.setopt(pycurl.SSL_VERIFYHOST, 2)
    c.setopt(pycurl.SSLKEY, os.environ['X509_USER_PROXY'])
    c.setopt(pycurl.SSLCERT, os.environ['X509_USER_PROXY'])
    c.setopt(c.WRITEDATA, buffer)
    c.perform()
    c.close()
    return buffer.getvalue()