Answer the question
In order to leave comments, you need to log in
Is it possible to block POST requests from localhost to a site?
I need to parse articles from the portal ras.arbitr.ru
On this resource, after clicking on the search button, a POST request is sent to ras.arbitr.ru/Ras/Search with parameters
{"GroupByCase":false,"Count":25,"Page":1,"DateFrom":"2000-01-01T00:00:00","DateTo":"2030-01-01T23:59:59",
"Sides":[],"Judges":[],"Cases":[],"Text":""}
{"Result":{"PagesCount":40,"TotalCount":23840237,"NumOnPage":25,"Page":1,"ReturnCount":1000,"Items":[{"Id":"54ec7dd5-10cd-4425-b8c0-46f509eec71f","CaseId":"6ba8cdf0-7df8-4708-8b03-471ce85eb997","RegistrationDate":"18.02.2025","InstanceNumber":"А71-4617/2012"...}
import requests
import json
payload = {"GroupByCase":False,"Count":25,"Page":1,"DateFrom":"2000-01-01T00:00:00","DateTo":"2030-01-01T23:59:59","Sides":[],"Judges":[],"Cases":[],"Text":""}
r = requests.post("http://ras.arbitr.ru/Ras/Search", data=payload)
print(r.status_code, r.reason)
(500, 'Internal Server Error')
data = json.dumps({"GroupByCase":False,"Count":25,"Page":1,"DateFrom":"2000-01-01T00:00:00","DateTo":"2030-01-01T23:59:59","Sides":[],"Judges":[],"Cases":[],"Text":""})
c = pycurl.Curl()
c.setopt(pycurl.URL, 'http://ras.arbitr.ru/Ras/Search')
c.setopt(pycurl.HTTPHEADER, [
"Accept:application/json, text/javascript, */*",
"Accept-Encoding:gzip, deflate",
"Accept-Language:en-US,en;q=0.8,ru;q=0.6",
"Connection:keep-alive",
"Content-Length:149",
"Content-Type:application/json",
"Cookie:ASP.NET_SessionId=eob3w5vypepmykpcsixfpxyv; __utmt=1; CUID=49784dc2-a97e-4249-8c61-415fe5f6f081:QNsAJT4ya5WN7jeL7jCECg==; __utma=160997822.296078651.1469210605.1469210605.1469257019.2; __utmb=160997822.4.10.1469257019; __utmc=160997822; __utmz=160997822.1469210605.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)",
"Host:ras.arbitr.ru",
"Origin:http://ras.arbitr.ru",
"Referer:http://ras.arbitr.ru/",
"User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36",
"X-Requested-With:XMLHttpRequest"
])
c.setopt(pycurl.POST, 1)
c.setopt(pycurl.POSTFIELDS, data)
c.perform()
Answer the question
In order to leave comments, you need to log in
See what the browser sends in headers. And pass the same.
From user agent, referrer, to cookie transfer
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question