I am trying to post a request on a website that requires credentials. I have used postman and sync with the browser using interceptor (google extension) to make use of the cookies stored correctly in postman. I have succeeded in posting the request in postman and here is the settings I did.
When trying to copy the code of the Python requests package, I got an invalid response 404
and something went wrong.
Here's the python code I got from Postman (not working)
import requests
url = "https://eservices.moj.gov.kw/execFileUpload2"
payload = {'selectAser': '211053300',
'phoneNo': '55075052',
'selectAsed': '120987470-1',
'comReg': '',
'bankType': '1850',
'attachments': '(binary)',
'searchType': '0745'}
files=[
]
headers = {
'Cookie': 'BNES_JSESSIONID=FBVxGgtjjJhDGmcnG/XOglUeuJlG/mwpJH9+ICQw/bL3/2Y383HWR4f+WzRXsJBG5jHf33qCsgMBOHLeTKxJRBwlkrkKE1tGbdywVgdikWhC4VcCUd1yIIYJBFm4m/60lfkGqvgk+UfaMbPKe3CUVRvsTaMCLn+A; BNIS___utm_is1=834onz3cMbm6+rxfXql7Q9R5wUqKP9h0Og9waF061RytqqFpbicKoodJVczfRblgLKkNejO9xULfy/gV59QKOKqOE5nH62HC/3yuYJehn8hT5JL0Trtl1Q==; BNIS___utm_is2=h3TrzcqVULgLWXXvNz3L2bQtrG+U/tHgaCBTF5MLDA6zaHEpzzwCy9Rj99RJySZUYmO8bQuFJ6s=; BNIS___utm_is3=xl2RfksMuxdJJrgDWe3RlTXaGAMcCXNp8jk39UeD37JWegODHQm0CVYCakYal9jUfWovaY2FrKriBIFNQOFbyIxcgMpHKnERXJrFCsvLKrmZNPgeZdMezA==; BNIS_vid=dVdYD1HKY4P0pa5whnuuvLgo71u2130LdG9wpcgfK0yYw3B1mLAfK2pzLr7+xPH1h3PVudRNDGJQHyVY0Y9fVfhte25qE3ArdMOHRB4jcyMGq/9iCsU5goBa1Q2hVs/8Fqd53PjKs7hT81XeYQ8Jtani11zEpPgkw70aLejHmSSykk8nACMnKMr0zP4RqoujmqEbAHE3+e6Odf2XSkBCWh3jPiyUqWmU4zYGail1N6A=; JSESSIONID=6ZLK74MAMrYOWAb39OQ7EYLHtt9GjRFzwvgwACd9idbb76Fe7q4p!669384774'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
This is the response I got
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html dir="rtl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<title>::بوابة العدل الالكترونية::</title>
<link type="text/css" rel="stylesheet" href="/Styles/NMaster.css" />
<style type="text/css">
<!--
H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
PRE, TT {border: 1px dotted #525D76}
A {color : black;}A.name {color : black;}
-->
</style>
</head>
<body>
<h1 style="text-align:center;">حدث خطأ ما </h1>
</body>
</html>