POST Requests With Headers And Data Results In 200 Ok Response But No User Added
Before creating this query checked few existing posts in this topic and followed the steps there, Still could not get it through hence raising this again here for solutions. The fo
Solution 1:
you need to uncomment part of # obtain CSRF cookie
to obtain new x-csrftoken
and if I see in your Chrome headers, its id
not pine_id
?
import requests
import json
headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36',
'origin':'https://www.example.com',
'referer':'https://example.com/script/Zo-Tester/',
}
payload = {
'username_recip':'xxxxyyzzz',
'pine_id':'PUB;FMx5WvjpGrmETV' # it should be 'id' ?
}
url = 'https://www.example.com/ne_rm/add/'
initial_url = 'https://example.com/script/Zo-Tester/'
with requests.Session() as session:
# obtain CSRF cookie
initial_response = session.get(initial_url)
headers['x-csrftoken'] = session.cookies['csrftoken']
# Now actually post with the correct CSRF cookie
response = session.post(url, headers=headers, data=payload)
print(response)
input("wait")
Post a Comment for "POST Requests With Headers And Data Results In 200 Ok Response But No User Added"