F
F
FaustGette2020-08-03 18:33:57
Python
FaustGette, 2020-08-03 18:33:57

In the browser, the response from the resource is one, in the script - another. Why?

I make a request through the browser, copy the url: https://processing.ruscorpora.ru/search.xml?env=al... I

parse it into tags

params = {}
for tag in full_url.split('&'):
    key, val = tag.split('=')
    params[key] = val


I make a request via
res = requests.get(url, params=params)

AND I get an empty page:
5f282a2fec1be519931642.png

However, as soon as you remove gramm1=acc%2C+sg from the parameters, the result appears on the page. Moreover, if gramm1 has only one value, then the result is: gramm1=acc , for example.

What is it, why does it occur and how to remove it? Appeared a couple of days ago, before that everything worked fine.
Thank you in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2020-08-03
@FaustGette

In general, everything works for me.
However, it is strange to see a request passing parameters via params .
Well, the first parameter is separated from the url not by an ampersand, but by a question mark.
Print params, you will see what is there

{'https://processing.ruscorpora.ru/search.xml?env': 'alpha', 'api': '1.0', 'mode': 'main', 'sort': 'i_grtagging', 'lang': 'ru', 'nodia': '1', 'text': 'lexgramm', 'lex1': '%D0%BA%D0%BE%D1%80%D0%BF%D1%83%D1%81', 'gramm1': 'acc%2C+sg'}

Hence two questions
1. Do you somehow additionally change the parameters by removing unnecessary values?
2. Why not just make a request for full_url right away?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question