Search code examples
pythoncookiescookie-httponly

Python script cannot retrieve HttpOnly cookies


I have a python script that retrieves cookies from a url with a login and secure ssl, it has some cookie values with _rest': {'HttpOnly': True} and my script won't return these cookies.

Is there any way I can get them? Currently my script looks like:

s = requests.Session()
url = "http://example.net/login"
r = s.post(url, auth=HTTPBasicAuth(USERNAME, PASSWD), verify=verify_ssl) 
for cookie in r.cookies: 
    print(cookie)

please help me get those delicious HttpOnly cookies


Solution

  • Found the issue - post did not contain the cookie in question cookie only available with get

    r = s.get(url, auth=HTTPBasicAuth(USERNAME, PASSWD), verify=verify_ssl)