B
B
balgarot2021-08-10 15:21:22
Python
balgarot, 2021-08-10 15:21:22

How to write a post request in python?

I have a request to send a profile, I tried to parse it, but I still didn’t understand that I need to write a post request in python, I entered it in the request

import requests
import time
x = 0
while x < 1000:
  x += 1
  requests.post('http://site.ru/forms/addform.php', data={'Data':'question_494842=78.+%D0%9C%D1%83%D0%BD%D0%B8%D1%86%D0%B8%D0%BF%D0%B0%D0%BB%D1%8C%D0%BD%D0%BE%D0%B5+%D0%BA%D0%B0%D0%B7%D0%B5%D0%BD%D0%BD%D0%BE%D0%B5+%D1%83%D1%87%D1%80%D0%B5%D0%B6%D0%B4%D0%B5%D0%BD%D0%B8%D0%B5+%D0%BA%D1%83%D0%BB%D1%8C%D1%82%D1%83%D1%80%D1%8B+%D0%9C%D1%83%D0%BD%D0%B8%D1%86%D0%B8%D0%BF%D0%B0%D0%BB%D1%8C%D0%BD%D0%BE%D0%B3%D0%BE+%D0%BE%D0%B1%D1%80%D0%B0%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F+%D0%B3%D0%BE%D1%80%D0%BE%D0%B4+%D0%98%D1%80%D0%B1%D0%B8%D1%82+%C2%AB%D0%98%D1%81%D1%82%D0%BE%D1%80%D0%B8%D0%BA%D0%BE-%D1%8D%D1%82%D0%BD%D0%BE%D0%B3%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9+%D0%BC%D1%83%D0%B7%D0%B5%D0%B9%C2%BB&question_494847=%D0%B4%D0%B0&question_494849=%D0%B4%D0%B0&question_494851=%D0%B4%D0%B0&question_494852=%D0%B4%D0%B0&question_494853=%D0%B4%D0%B0&question_494854=%D0%B4%D0%B0&question_494855=%D0%B4%D0%B0&question_494856=%D0%B4%D0%B0&question_494857=%D0%B4%D0%B0&question_494858=%D0%B4%D0%B0&question_494859=%D0%B4%D0%B0&question_494860=%D0%B4%D0%B0&question_494861=%D1%81%D0%B2%D0%BE%D0%B5%D0%B2%D1%80%D0%B5%D0%BC%D0%B5%D0%BD%D0%BD%D0%BE+&question_494863=%D0%BD%D0%B5%D1%82+%28%D0%BF%D0%B5%D1%80%D0%B5%D1%85%D0%BE%D0%B4+%D0%BA+%D0%B2%D0%BE%D0%BF%D1%80%D0%BE%D1%81%D1%83+7%29&question_494871=%D0%B4%D0%B0&question_494872=%D0%B4%D0%B0&question_494874=%D0%B4%D0%B0&question_494875=%D0%B4%D0%B0&question_494876=%D0%B4%D0%B0&question_494877=%D0%B4%D0%B0&question_494878=%D0%B4%D0%B0&question_494879=%D0%B4%D0%B0&question_494880=%D0%B4%D0%B0&question_494881=&form_id=90'})
  time.sleep(2)
else:
  print('цикл был сделан', x,'раз')

As I understand it, I need to set request headers in some other way from the browser? Or something else? Just as I already checked by sending this request to the server, the form will not count.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-08-10
@balgarot

It looks like google forms, but it has a different endpoint and slightly different names. Without a link to the site, no one can guess what is needed there

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question