K
K
kreativ_252020-11-08 22:35:39
Parsing
kreativ_25, 2020-11-08 22:35:39

How to parse ajax with hidden parameters?

How can I parse ajax on pytnon if parameters are hidden?
In my case, the date parameter is hidden.

Link

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mark Chigrin, 2020-11-09
@kreativ_25

It's not at all clear what you need. And what are hidden parameters anyway. In the developer console in network, all requests are visible - a simple post with form data. Postman pulled it out easily. Here's how to do the same on requests

import requests

url = "http://www.nbrb.by/statistics/financialmarkets/interbankrates"

payload = 'date=10.10.2020'
headers = {
  'Accept': 'text/html, */*; q=0.01',
  'X-Requested-With': 'XMLHttpRequest',
  'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36',
  'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
}

response = requests.request("POST", url, headers=headers, data = payload)

print(response.text.encode('utf8'))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question