Hi guys I having trouble with SSL and python. I had a script that goes to f5 API with requests and it was worked fine. I did another API script. Tried it on another machine (some VPN system I can't provide the name) also with requests package since my python API script with requests package doesn't work. I know the problem started when I tried to approach the other machine's API because the problem I have is on 2 machines. On the other machine I did it on purpose to see if that was my problem (I was right sadly).
Example to script that worked:
def f5_ltm_01_active_status():
response = requests.get("https://<ip-address>/mgmt/tm/cm/device/ver=12.1.3.4", auth=("user","password"),verify=False)
try:
json_response = response.json()
if json_response["items"][0]['hostname']:
return_str = "%s is %s" %(json_response["items"][0]['hostname'],json_response["items"][0]['failoverState'])
else:
return_str = "Wrong value in JSON"
except:
return_str = "Something went wrong , please check the code "
finally:
return return_str
The error that the Python returned is:
raise SSLError(e, request=request) requests.exceptions.SSLError:
HTTPSConnectionPool(host='ip-address-of-f5', port=443): Max retries
exceeded
with url: /mgmt/tm/cm/device?ver=12.1.3.4 (Caused by SSLError("Can't
connect
to HTTPS URL because the SSL module is not available."))
If I operate the script in debug mode it works.
I am using Windows 10
I am using Python v3.7.2
Another thing that I tried to do:
looking in Stackoverflow for answers
looking at Google to try to get answers
erase Pycharm and reinstall
erase python and reinstall
erase requests pack and urllibs3 pack and reinstall
install open-ssl - pyopenssl pack
I am really want to get an answer and idea of how and why did it happen but mainly how to fix it