Last active
July 25, 2019 09:22
-
-
Save peketamin/7e20e15d26cbac0fa5db394b0b1ddabd to your computer and use it in GitHub Desktop.
requests_post_with_csrf.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
url = 'http://localhost:8000/xxx/unsubscribe/xxx' | |
session = requests.session() | |
res_get = session.get(url) | |
resp_post = session.post( | |
url, | |
data={"csrfmiddlewaretoken" : session.cookies['csrftoken']}, | |
headers={'referer': url} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment