我有一个API,在那里我需要得到不记名令牌。当我使用' Postman '应用程序,我得到不记名令牌正确。我已经写了下面的Python代码相同,但我得到下面的错误。请帮助。我需要发送用户名和密码的身体作为一个形式的数据。
import requests
url = "https://322.286.24.01/ach/ach_api/login"
payload={'username': 'test',
'password': 'test12'}
response = requests.post( url,data=payload)
print(response.text)
错误代码:
Traceback (most recent call last):
File "/tmp/test.py", line 13, in <module>
response = requests.post(url,data=payload)
File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 119, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='322.286.24.01', port=443): Max retries exceeded with url: /ach/ach_api/login (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1123)')))
1条答案
按热度按时间3phpmpom1#
此错误是因为请求尝试检查ca证书,请尝试以下操作:
或者,如果你有一个ca.crt文件,通常是pem格式,你可以试试:
此外,IP地址看起来很有趣,虽然由于客户端连接,我怀疑你只是改变了匿名您的职位?