Reputation: 3910
Is it possible to access raw data from this site using python requests?
In the network tab, I found getAllDeclaration
item that has POST
method and specifies requests payload parameters.
So far I've tried this:
url = "https://cab.vkksu.gov.ua/rest/qa2_resultLatest/"
payload = {"PIB": "Іванов Іван Іванович", "docTypeID": "3000000768001", "yearString": "2018", "pageNum": 0}
# `docTypeID` I got from https://cab.vkksu.gov.ua/rest/qa2_interview/getInterviewType"
requests.post(url, payload)
# results in 400 response code
Upvotes: 1
Views: 74
Reputation: 4963
Try the following code, pretty sure you messed up the url part.
import requests
url = "https://cab.vkksu.gov.ua/rest/qa2_resultLatest/getAllDeclaration"
data = {
"PIB": "Іванов Іван Іванович",
"docTypeID": "3000000768001",
"yearString": "2018",
"pageNum": 0
}
response = requests.post(url, json=data)
print(response.json())
Upvotes: 2
Reputation: 1639
Try this:
import json
url = "https://cab.vkksu.gov.ua/rest/qa2_resultLatest/"
payload = {"PIB": "Іванов Іван Іванович", "docTypeID": "3000000768001", "yearString": "2018", "pageNum": 0}
header = "application/json"
mydata = json.dumps(payload)
# `docTypeID` I got from https://cab.vkksu.gov.ua/rest/qa2_interview/getInterviewType"
resp = requests.post(url, mydata,header)
print(resp.content)
Upvotes: 0