Python SSL证书错误X509\u加载\u证书\u crl\u文件
当我运行python程序时,我遇到了这个错误Python SSL证书错误X509\u加载\u证书\u crl\u文件,python,ssl,ssl-certificate,python-requests,sumologic,Python,Ssl,Ssl Certificate,Python Requests,Sumologic,当我运行python程序时,我遇到了这个错误 File "get_secure_log.py", line 59, in <module> query_sumo_logic() File "get_secure_log.py", line 56, in query_sumo_logic resp = s.post(api_endpoint) File "/usr/lib/python2.6/site-packages/requests/sessions.py"
File "get_secure_log.py", line 59, in <module>
query_sumo_logic()
File "get_secure_log.py", line 56, in query_sumo_logic
resp = s.post(api_endpoint)
File "/usr/lib/python2.6/site-packages/requests/sessions.py", line 349, in post
return self.request('POST', url, data=data, **kwargs)
File "/usr/lib/python2.6/site-packages/requests/sessions.py", line 288, in request
resp = self.send(prep, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies)
File "/usr/lib/python2.6/site-packages/requests/sessions.py", line 383, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.6/site-packages/requests/adapters.py", line 213, in send
raise SSLError(e)
requests.exceptions.SSLError: [Errno 185090050] _ssl.c:330: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib
你试过用sudo运行它吗?@Raskayu我试过了,但问题是一样的。我想如果我能以某种方式更改默认的ca_捆绑包,可能会奏效。因为python使用自己的ca_捆绑包。但在这里,我想提供另一个ca_捆绑包。但是我找不到一种方法来为python提供另一个ca_包。可能是@tripleee的重复。我不知道如何使它工作,你能详细说明一下吗。我可以在python中添加或与pyhton一起使用它吗?
#!/usr/bin/env python
#author : Kumar Shubham
import json
import sys
import requests
import datetime
def query_sumo_logic():
# Set variables from options.yml file
query = '_source=secure_logs'
period = 90
ldapuser = 'ldapuser'
ldappass = 'Hldappass'
sumouser = 'sumouser'
sumopass = 'sumopass'
api_endpoint = 'https://api.au.sumologic.com/api/v1/collectors?limit=2'
proxy = 'https://{user}:{pass}@proxy-url:8080'
# Replace placeholders in proxy for username/password with
# LDAP user/pass
if '{user}' in proxy:
proxy = proxy.replace('{user}', ldapuser)
if '{pass}' in proxy:
proxy = proxy.replace('{pass}', ldappass)
time_delta = datetime.timedelta(days=period)
to = datetime.datetime.utcnow().replace(microsecond=0)
from_ = to - time_delta
data = {
'query': query,
'from': from_.isoformat(),
'to': to.isoformat(),
'timeZone': 'UTC'
}
headers = {
'content-type': 'application/json',
'accept': 'application/json',
'user-agent': 'curl/7.43.0'
}
proxy_dict = {
'http': proxy.replace('https', 'http'),
'https': proxy,
'ftp': proxy.replace('https', 'ftp')
}
# Set up session object including auth, proxy and headers
s = requests.Session()
s.auth = (sumouser, sumopass)
s.headers.update(headers)
s.proxies = proxy_dict
# Create job
resp = s.post(api_endpoint)
print resp
query_sumo_logic()