Answer the question
In order to leave comments, you need to log in
How to send Request Payload via Requests library?
It is necessary to automate the receipt of referral links from the site . When receiving a link manually, the browser sends a post request with the Payload part:
I am also trying to make such a request:
def getUrl(login, password, link):
with requests.Session() as session:
data = dict(username=login, password=password, remember=1, check_ip=0)
url = session.get('https://epn.bz')
login = session.post('https://epn.bz/ru/auth/login', data=data, cookies=url.cookies)
cabinet = session.get('https://epn.bz/ru/cabinet/', cookies=login.cookies)
payload = {'all_banners': False,
'attract_to_cashback': False,
'cookie_time': "30days",
'desc': 'programme',
'expiration_time': '',
'format': '1',
'image': '',
'isAllow': 0,
'lang': 'ru',
'link': link,
'no_affiliate_direct': True,
'offer_type': 'ali',
'rejectChange': False,
'selected_banners': [],
'size': None}
create = session.post('https://epn.bz/ru/creative/create', data=payload, cookies=cabinet.cookies)
print(create.text)
Answer the question
In order to leave comments, you need to log in
Read and look in the browser Request Headers . Most likely you need to fake HTTP_REFERER.
The problem turned out to be in the transmitted headers and in the json format of the payload part, everything is resolved
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question