pycurl and SSL cert

后端 未结 2 2031
囚心锁ツ
囚心锁ツ 2021-02-02 09:33

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)         


        
2条回答
  •  醉话见心
    2021-02-02 10:04

    Have you read the cURL documentation about SSL certificates? This seems to directly address your question...in particular, item 2:

     2. Get a CA certificate that can verify the remote server and use the proper
        option to point out this CA cert for verification when connecting. For
        libcurl hackers: curl_easy_setopt(curl, CURLOPT_CAPATH, capath);
    

    It looks like the pycurl module contains the CAPATH option, so this should be simple to implement in your code.

提交回复
热议问题