Closed jonluca closed 4 years ago
Chrome will let you export a network call as curl by right clicking it -> copy -> copy as curl.
Chrome also likes to export long cookies like such:
curl 'https://someurl.com' \ -H 'Connection: keep-alive' \ -H 'Cache-Control: max-age=0' \ -H 'sec-ch-ua: "Google Chrome"; v="83"' \ -H 'sec-ch-ua-mobile: ?0' \ -H 'DNT: 1' \ -H 'Upgrade-Insecure-Requests: 1' \ -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4093.3 Safari/537.36' \ -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \ -H 'Sec-Fetch-Site: none' \ -H 'Sec-Fetch-Mode: navigate' \ -H 'Sec-Fetch-User: ?1' \ -H 'Sec-Fetch-Dest: document' \ -H 'Accept-Language: en-US,en;q=0.9,it;q=0.8,la;q=0.7' \ -H $'Cookie: somereallyreallylongcookie=true;' \ --compressed
This gets spit out as:
requests.get("https://someurl.com", headers={ "$Cookie": "somereallyreallylongcookie=true;", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "Accept-Language": "en-US,en;q=0.9,it;q=0.8,la;q=0.7", "Cache-Control": "max-age=0", "Connection": "keep-alive", "DNT": "1", "Sec-Fetch-Dest": "document", "Sec-Fetch-Mode": "navigate", "Sec-Fetch-Site": "none", "Sec-Fetch-User": "?1", "Upgrade-Insecure-Requests": "1", "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4093.3 Safari/537.36", "sec-ch-ua": "\"Google Chrome\"; v=\"83\"", "sec-ch-ua-mobile": "?0" }, cookies={}, )
by uncurl. Notice the $Cookie instead of Cookie.
Thanks for opening. Let me know if the fix doesn't work!
Chrome will let you export a network call as curl by right clicking it -> copy -> copy as curl.
Chrome also likes to export long cookies like such:
This gets spit out as:
by uncurl. Notice the $Cookie instead of Cookie.