How to use cookies generated from one command/request into another command/request using python’s request module like we do with curl commands?
Below are the two curl requests in which cookies generated from first command are used second curl command and also cookie_jar file is updated with new parameters to be used in later third curl commands
# First Curl Command/Request
curl -c cookie_jar --location --request POST 'https://exmaple.com/api/wealth/mobile/auth/login'
--header 'api-key: qweqwexxc123ewervdssdf'
--header 'request-id: login'
--header 'Content-Type: application/json'
--data-raw '{
"locale": "en",
"signinId": "[email protected]",
"password": "xxxxxx",
"remembered": "false",
"trueIP": "192.168.0.1"
}'
curl -b cookie_jar -c cookie_jar --location --request POST 'https://example.com/api/wealth/mobile/mfa/evaluatemfa'
--header 'api-key: xxeer2345632'
--header 'request-id: xxx'
--header 'Content-Type: application/json'
--data '{
"deviceFingerPrint": {
"platform": "iOS",
"language": "en",
"fingerprintCookie": "QWERASDF-WER4-334e-AQW3456-154780ASDF",
"platformVersion": "14.3",
"jailbreak": "false",
"screenWidthHeight": "375.00",
"appVersion": "1.56",
"ipAddress": "192.168.0.56",
"plugins": "",
"userAgent": ""
}
}'
cookies values in cookie_jar file are dynamic values and are absolutely needed for authentication to work.
So how can we save cookies from the first curl command and later use them in the second curl command request using python’s requests
module?