简体   繁体   English

在Windows 7 64位上验证Python中的SSL证书

[英]Verify SSL Certificate in Python on Windows 7 64 bit

I need help in verifying SSL certificate within the company's firewall when trying to access the cloud hosted application https://www.quickbase.com/ . 在尝试访问云托管应用程序https://www.quickbase.com/时,我需要帮助验证公司防火墙内的SSL证书。 The pyquickbase module works perfectly when I run the script from home. 当我从家里运行脚本时,pyquickbase模块工作正常。 Here is my code and traceback for your reference. 这是我的代码和回溯供您参考。

    ### Python script to log into database
    import quickbase
    client = quickbase.Client(username='JohnDoe',password='OpenQB', database='qb_database',
                              apptoken='xxxdfdafd', base_url="https://www.quickbase.com")

    response = client.list_db_pages(database='qb_database')
    print(response)
    ###

Traceback (most recent call last): Traceback(最近一次调用最后一次):

    File "D:\Users\User123\Documents\pyfund\Quickbase\QB_api_check.py", line 3, in <module>
apptoken='xxxdfdafd', base_url="https://www.quickbase.com")
    File "C:\Python27\lib\site-packages\quickbase.py", line 191, in __init__
self.authenticate()
    File "C:\Python27\lib\site-packages\quickbase.py", line 263, in authenticate
required=['ticket', 'userid'], ticket=False)
    File "C:\Python27\lib\site-packages\quickbase.py", line 219, in request
request = requests.post(url, data, headers=headers)
    File "C:\Python27\lib\site-packages\requests\api.py", line 111, in post
return request('post', url, data=data, json=json, **kwargs)
    File "C:\Python27\lib\site-packages\requests\api.py", line 57, in request
return session.request(method=method, url=url, **kwargs)
    File "C:\Python27\lib\site-packages\requests\sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
    File "C:\Python27\lib\site-packages\requests\sessions.py", line 585, in send
r = adapter.send(request, **kwargs)
    File "C:\Python27\lib\site-packages\requests\adapters.py", line 477, in send
raise SSLError(e, request=request)
    SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)

Ok, I tried setting up the proxy with OS environment variable and that did not work since the requests.get required that I pass the proxy within the call. 好吧,我尝试使用OS环境变量设置代理,但由于requests.get要求我在调用中传递代理,因此无效。 I created a proxy Dict as 我创建了一个代理Dict作为

proxyDict = { 
              "http"  : http_proxy, 
              "https" : https_proxy, 
              "ftp"   : ftp_proxy
            }

The https one was the one that was required in order to receive SSL certificate. https one是接收SSL证书所必需的。 I will now have to modify the quickbase and pybase modules that I am using to explicitly include the proxies in the calls. 我现在必须修改我使用的quickbase和pybase模块,以明确地在调用中包含代理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM