Apr-04-2021, 08:17 PM
(This post was last modified: Apr-04-2021, 08:22 PM by johnboy1974.)
Hi,
I'm trying to convert a response which I think is in Unicode? I am using the requests library to get data from an API. I am running the following:
{"id":10735,"name":"CR B\\u00e9ni Thour"}
But that should come back as:
{"id":10735,"name":"CR Béni Thour"}
Not sure what I'm doing wrong?
Many thanks!
J
I'm trying to convert a response which I think is in Unicode? I am using the requests library to get data from an API. I am running the following:
import requests url = "https://api-football-v1.p.rapidapi.com/v3/standings" querystring = {"season":"2020","league":"187"} headers = { 'x-rapidapi-key': "asdfasdfasdfasdfasdf", 'x-rapidapi-host': "api-football-v1.p.rapidapi.com" } response = requests.request("GET", url, headers=headers, params=querystring) strResponse = response.text utf8string = strResponse.encode("utf-8") print(utf8string)It doesn't work though. In that response, I have the likes of:
{"id":10735,"name":"CR B\\u00e9ni Thour"}
But that should come back as:
{"id":10735,"name":"CR Béni Thour"}
Not sure what I'm doing wrong?
Many thanks!
J