Anaplan SSL wrong version number issue in Import action
Hello Team,
I have Pyhton code that connects to Anaplan using API 2.0 and import data.I am using proxy server to connect. This was working fine until yesterday we found below error from my application.
Error occurred:- Exception method name:- auth_request exception details:- HTTPSConnectionPool(host='auth.anaplan.com', port=443): Max retries exceeded with url: /token/authenticate (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1122)')))
Let me know if you need more details.
Best Answer
-
Thanks @riyazpasha @ben_speight for the reply.
Yes, it was proxy issue. Providing resolution for this if anyone encounters in future.
Instead of https, http in proxy json value worked for me.
"https" : "http/servername:8080"
1
Answers
-
Hey @rahulnair,
I can see if I can help. Do you have your full Python script? Are you able to paste a masked verison of this into this therad?
Look forward to your reply. I will start to do some preliminary research in the meantime.
Thanks,
Daanish
0 -
Thanks @DaanishSoomar for the reply
Please find below code, As I mention earlier my program was working until yesterday now authenticate itself is not working.
def auth_request(header, body):
'''
:param header: Authorization type, CACertificate or Basic
:param body: POST request body: encodedData (150-character nonce), encodedSignedData (encodedData value signed by private key)
'''
try:
anaplan_url='https://auth.anaplan.com/token/authenticate'
if body == None:
r=requests.post(anaplan_url, headers=header,proxies= "http://proxyserver:8080")
else:
r=requests.post(anaplan_url, headers=header, data=json.dumps(body),proxies= "http://proxyserver:8080")
#Return the JSON array containing the authentication response, including AnaplanAuthToken
return r.text
except Exception as e:
configs.LogException("auth_request",e)When I use http://proxyserver:8080 proxy I get following error
Error occurred:- Exception method name:- auth_request exception details:- HTTPSConnectionPool(host='auth.anaplan.com', port=443): Max retries exceeded with url: /token/authenticate (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_ACCESS_DENIED] tlsv1 alert access denied (_ssl.c:1122)')))
When use https://proxyserver:8080 proxy I get following error
Error occurred:- Exception method name:- getTokenCACErt exception details:- HTTPSConnectionPool(host='auth.anaplan.com', port=443): Max retries exceeded with url: /token/authenticate (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1122)')))
0 -
I suspect the problem lies in the proxy server. Can you try sending a simple HTTP request through it using something else, eg
curl -v -x proxyserver:8080 https://auth.anaplan.com/hola
0 -
Hi @rahulnair ,
Your request is being tunnelled to the proxy server which means you have to provide the proxy authentication.
Get the proxies via below code
import urllib.request
proxies = urllib.request.getproxies()
print(proxies)
And provide the proxy in the request call as shown below
http': 'http://domain%5Cusername:password@ProxyIP:portnumber'
if your password has special characters you to percent encode your password otherwise it will tunnel the request.
Also check if your get request has verify=True
requests.get('https://google.com', verify=False)
Regards,
Riyaz Pasha
0