I am trying to open a json file from an API with includes characters of the polish alphabet. I have tried to encode the url into utf-8 but still all kind of problems pop up. I include the code I wrote and the error that appears.
import urllib.request as request
import json
url='https://api.um.warszawa.pl/api/action/dbtimetable_get?id=myapiID&busstopId=wartość&busstopNr=wartość&line=wartość&apikey=wartość'
url=url.encode('utf-8')
with request.urlopen(url) as response:
source = response.read()
data = json.loads(source)
Then the error: 'bytes' object has no attribute 'timeout' appears.