Hack Forums
[Python] Python Requests - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Python] Python Requests (/showthread.php?tid=6181682)



Python Requests - HardStoN - Nov 19, 2021

So im using python requests to send a get request to a cloudflare's site

I opened fiddler to see the request and i see there the Cookie header as it should be, altough the site responds with a message saying
Please enable cookies.

This is how i was sending the cookies. (The cookies object is a dict)
Code
sess.get(url, headers=headers, cookies=cookies, verify=False)



RE: Python Requests - john__john - Dec 2, 2021

Hi, can u post the entire source code? Thanks


RE: Python Requests - TransfemMarxist - Dec 6, 2021

Use sessions.

Code
import requests

s = requests.Session()
r = s.get(url, headers=headers, cookies=cookies, verify=False)
print r.status_code
print r.text