I'm struggling with the deezer api.
I want to perform a request which contains umlaute.
While the usual python requests library converts the following:
'album:"Ich schwanke noch" artist:"Ikke Hüftgold"'
To this api search request:
https://api.deezer.com/search/album?q=album%3A%22Ich+schwanke+noch%22+artist%3A%22Ikke+H%C3%BCftgold%22
Which is from utf-8 standards, totally fine as long as I understood.
But unfortunately, deezer don't accept them or just delivers an empty result.
This would be the code to reproduce:
import requests
search_url = 'https://api.deezer.com/search/'
query_type = 'album'
query = 'album:"Ich schwanke noch" artist:"Ikke Hüftgold"'
response = requests.get(
search_url + query_type, params={'q': query}
)
print(response.url)
After a deep dive I found out, deezer accepts only the following character set. Only the two Unicode (HTML) from this article: https://de.wikipedia.org/wiki/Hilfe:Sonderzeichenreferenz
So manually the request look like this:
https://api.deezer.com/search/album?q=album:%22Ich%20schwanke%20noch%22%20artist:%22Ikke%20Hüftgold%22
But how on earth could I tell python to encode using this set. I didn't find anything till now.
I would love to found help on this way.
This has nothing to do with the encoding, it's how you are using the the search API:
Out:
Edit:
You need to convert non-ASCII characters to HTML Unicode entities:
Out: