1

I am trying to connect Informatica cloud from python script and sending POST call to the server. But it is failing with an unknown protocol error.

Code Snippet:

import requests

url = "https://xxxxxx.com/informatica/identity-service/api/v1/Login"

payload="{\r\n    \"username\": \"xxxxx\",\r\n    \"password\": \"xxxxxx\"\r\n}"

headers1 = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'keyId': 'xxxxxxx'
}

response = requests.request('POST', url, data=payload, headers=headers1, verify=False ) 

The same POST request is working fine in postman toll and getting response correctly. But hitting with ssl unknown protocol error while invoking post through Python script.

I am executing both Python & Postman in Windows10.

Can anyone assist me to resolve this error?

Error Message:

HTTPSConnectionPool(host='xxxxxx.com', port=443): Max retries exceeded with url: /informatica/identity-service/api/v1/Login (Caused by SSLError(SSLError(1, '[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:748)'),))

Python version - 3.6.2 pip version - 21.0.1 openssl version - OpenSSL 1.0.2k

saminfa
  • 11
  • 1
  • 6
  • 443 means you made too many requests so you need to wait until the next one. Check in the docs for request limit – DeadSec Mar 16 '21 at 10:38
  • I am not sending multiple requests. Its a single request to create a login session. The same POST request to create login session is working in Postman tool which is also I am running it on the same machine where I am running the python script. – saminfa Mar 16 '21 at 11:18
  • Try adding a user agent and making payload a dic instead of a string. – DeadSec Mar 16 '21 at 11:53
  • no luck. I am still getting same error. payload={'username': 'xxx', 'password': 'xxx'} I tried with all below different User agents in the request. Its not working for all of them. 'User-Agent': 'PostmanRuntime/8.0.7' 'User-Agent':'Mozilla/5.0' 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36' User-Agent':'python-requests/2.24.0' – saminfa Mar 16 '21 at 13:24
  • @DeadSec 443 is the port and has nothing to do with the HTTP status code. – Brad Solomon Mar 16 '21 at 13:36
  • @BradSolomon just noticed that. Sorry about that. Wasn't paying attention, probably. – DeadSec Mar 16 '21 at 15:39
  • @DeadSec Do you think of any other issue on this. – saminfa Mar 17 '21 at 04:28
  • Try HTTP instead of https – DeadSec Mar 17 '21 at 08:21
  • No, the link is not working. – saminfa Mar 17 '21 at 12:42
  • Have you tried to upgrade your OpenSSL version? – Maxbester Apr 16 '21 at 13:14
  • we downgraded the Request version to 2.24.0. it resolved the SSL issue. – saminfa Apr 21 '21 at 10:24
  • on a side note, you are sending username and password in payload. hope that's encrypted – Shod Nov 29 '21 at 06:47
  • this helps? https://stackoverflow.com/questions/51768496/why-do-https-requests-produce-ssl-certificate-verify-failed-error – Shod Nov 29 '21 at 06:48

0 Answers0