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

时间:2016-07-18 21:37:27

标签: python api quickbase

在尝试访问云托管应用https://www.quickbase.com/时,我需要帮助验证公司防火墙内的SSL证书。当我从家里运行脚本时,pyquickbase模块工作正常。这是我的代码和追溯,供您参考。

    ### 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)
    ###

追踪(最近一次呼叫最后一次):

    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)

1 个答案:

答案 0 :(得分:0)

好的,我尝试使用OS环境变量设置代理,但由于requests.get要求我在调用中传递代理,因此无效。我创建了一个代理Dict为

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

https one是获得SSL证书所必需的。我现在必须修改我使用的quickbase和pybase模块,以明确地在调用中包含代理。