E
E
Erke942021-02-13 20:07:32
Python
Erke94, 2021-02-13 20:07:32

How to fix incorrect output of a get-request in the presence of Cyrillic characters?

Hello! I need help, when compiling a get-request with parameters with Latin characters, there are no problems, and when characters from Cyrillic come across, I get abra-kadabra, thus I can’t get data from the server. Googled it and couldn't find answers. Help fix the problem with the encoding, still quite green)

import requests

prms= {'trademark': 'Мечта'}
# prms= {'trademark': 'Mechta'}
url = 'http://api.site.kz/api/snn'
r = requests.get(url, params=prms)
print(r.url)


Console output:
api.site.kz/api/snn?trademark=%D0%9C%D0%B5%D1%87%D1%82%D0%B0

# api.site.kz/api/snn?trademark=Mechta

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2021-02-13
@Erke94

The console output is correct, as it should be .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question