M
M
marselabdullin2020-08-04 15:28:05
Python
marselabdullin, 2020-08-04 15:28:05

Why doesn't it decode the response?

I make a request to the api service to get data, but Russian characters are not readable as always, I changed the encoding to utf-8, but I still get abracadabra (...\u0434\u043d...). Here is the code that handles it:

import requests
import json

params = (
    ('API-Key', '*****'),
)

response = requests.get('http://api.cpanomer1.affise.com/3.0/offers', params=params)

response.encoding = 'utf-8'
print(response.text)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2020-08-04
@marselabdullin

1. that's ok, now do print(response.json())
2. firing the API-Key, not a good idea

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question