Google News

FREEMIUM
By BFD | Updated a month ago | News, Media
Popularity

9.9 / 10

Latency

683ms

Service Level

100%

Health Check

N/A

Back to All Discussions

PYTHON BUG CORRECTED: Supported Language & Settings

Rapid account: Theta 45 Com
theta45.com
9 months ago

I tried the python code to get a json list of supported languages.

But I got this error:

UnicodeEncodeError: ‘charmap’ codec can’t encode character ‘\u010c’ in position 209: character maps to <undefined>

THE FIX:

import http.client

conn = http.client.HTTPSConnection(“google-news13.p.rapidapi.com”)

headers = {
‘X-RapidAPI-Key’: “YOUR KEY”
}

conn.request(“GET”, “/languageRegions”, headers=headers)

res = conn.getresponse()
data = res.read().decode(“utf-8”)

print(data.encode(“utf-8”))

Join in the discussion - add comment below:

Login / Signup to post new comments