我可以使用 Postman 成功将请求发送到我的 CUCM(Cisco Unified Communications Manager)服务器的 API 服务。并且如图所示,这些请求都通过 TLSV1.2 协议成功发送(我也尝试过:TLSV1.1 和 TLSV1 成功)。
Wireshark 中的 Postman 请求:
邮递员请求详情:
但是当我使用Python发送请求时,请求始终通过SSLV3协议进行处理。由于我使用旧版本的 CUCM 服务器 (v-10.0),我收到以下错误:
Request error in terminal:
requests.exceptions.SSLError: HTTPSConnectionPool(host='172.25.0.6', port=8443): Max retries exceeded with url: /axl/ (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_ILLEGAL_PARAMETER] sslv3 alert illegal parameter (_ssl.c:1007)')))
**无论我如何努力,我都无法使用 Python 使用 TLSv1.2 或更旧的协议发送请求。我怎样才能强迫Python这样做?**
我还应该提到,我还使用 CURL 尝试了这些实验,它与 Python 一样,仅使用 SSLV3 发送请求。
以下是我的一些 Python 实验:
import requests
url = "https://172.25.0.6:8443/axl/"
headers = {
'Content-Type': 'text/plain',
'Authorization': 'Basic token=',
'Cookie': 'JSESSIONID=DCCokiee; JSESSIONIDSSO=SessionId'
}
payload = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://www.cisco.com/AXL/API/10.0\">\n <soapenv:Header />\n <soapenv:Body>\n <ns:executeSQLQuery sequence=\"?\">\n <sql>select first 10 * from numplan where dnorpattern='3335610'</sql>\n </ns:executeSQLQuery>\n </soapenv:Body>\n</soapenv:Envelope>"
response = requests.get(url, headers=headers)
if response.status_code == 200:
print("Success!")
print(response.text)
else:
print("Unsuccess. HTTP Kodu:", response.status_code)
response = requests.request("POST", url, headers=headers,auth=("username","password"), data=payload)
print(response.text)
or
response = requests.request("POST", url, headers=headers,auth=("username","password"), data=payload)
response = requests.request("POST", url,verify=False, headers=headers,,auth=("username","password"), data=payload)
response = requests.request("POST", url, verify='./cucm01.giganet.lan', data=payload, auth=("username","password"))
其他详情: 我在网上尝试了很多解决方案。但错误却没有丝毫变化。
操作系统:Ubuntu 22.04
Python:3.10
提前非常感谢...