Python Forum
Error while connecting to web application - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: Error while connecting to web application (/thread-21847.html)



Error while connecting to web application - harish - Oct-17-2019

Hi All,

While connecting to web application getting below error and I have hide the credentials with dummy values.
Error message:
b'{"__type":"SerializationException"}'

`

import requests
import json
api_login = 'xxxxx
api_password = 'xxxx
CLIENT_ID = 'xxxx'
AUTHFLOW = 'xxxxx
url = 'https://xxxxxx.com
payload = {
   "AuthParameters" : {
      "USERNAME" : api_login,
      "PASSWORD" : api_password
   },
   "AuthFlow" : AUTHFLOW,
   "ClientId" : CLIENT_ID
}
# Adding empty header as parameters are being sent in payload
headers = {}
headers ={"X-Amz-Target" : "xxxxxxx",
          "Content-Type" : "xxxxx"
          }
print(payload)
r = requests.post(url, data=payload, headers=headers)
print(r.content)
`

Thanks in Advance.
Regards,
Harish


RE: Error while connecting to web application - buran - Oct-17-2019

this doesn't look like error per se, it looks like JSON response that show something in your requests is not what it expects


RE: Error while connecting to web application - harish - Oct-17-2019

Thanks for your response. I have replaced json with data like "data=payload". Now code able to connect and provide response with API Token.


Regards,
Harish


RE: Error while connecting to web application - Khush - Sep-05-2020

Hi Harish im sure we are both trying to acces the same web application as i am recieving the same aws response too, however im not recieving an api key when i change data to json. could you help me with this