我正在使用Python2.7
,我需要访问某个API(Nuagen):https://nuagenetworks.github.io/vsd-api-documentation/usage.html
在文件中,他们说:
Getting the API key. To obtain and API key, the first step is to make a /me API call. This API call returns information about the account being used.
GET /me HTTP/1.1
X-Nuage-Organization: my company
Content-Type: application/json
Authorization: $AUTHORIZATION_STRING
^{pr2}$The authorization string for the /me API MUST be formatted like the following:
我试着按照我的要求来建造
import requests
url = 'https://an.ip.add.ress:8443/nuage/api/v4_0/me'
user = 'myuser'
passw = 'mypass'
cps = 'myorganization'
headers = {
"Authorization": "Basic d29jdTpjdXdv",
"Cache-Control": "no-cache",
"Content-Type": "application/json",
"X-Nuage-Organization": "csp",
}
response = requests.get(url, auth=(user, passw), headers=headers)
# Also tried with:
# response = requests.get(url, headers=headers)
但是,我总是遇到这样的错误:
requests.exceptions.SSLError: bad handshake: Error([('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate verify failed')],)
你知道如何用Python请求访问这个API吗?或者其他方式?在
目前没有回答
相关问题 更多 >
编程相关推荐