You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
urllib is throwing a urllib.error.HTTPError: HTTP Error 405: METHOD NOT ALLOWED error because languages() is not specifying a GET request. The fix is to change line 82 req = request.Request(url, data=url_params.encode()) to an explicit GET.
deflanguages(self):
"""Retrieve list of supported languages. Returns: A list of available languages ex. [{"code":"en", "name":"English"}] """url=self.url+"languages"params=dict()
ifself.api_keyisnotNone:
params["api_key"] =self.api_keyurl_params=parse.urlencode(params)
req=request.Request(url, data=url_params.encode(),method="GET")
response=request.urlopen(req)
response_str=response.read().decode()
returnjson.loads(response_str)```
The text was updated successfully, but these errors were encountered:
Isaha-Miller
changed the title
language request needs to be 'GET' in APIS.py
language() request needs to be 'GET' in APIS.py
Nov 5, 2024
urllib is throwing a
urllib.error.HTTPError: HTTP Error 405: METHOD NOT ALLOWED
error because languages() is not specifying aGET
request. The fix is to change line 82req = request.Request(url, data=url_params.encode())
to an explicitGET
.The text was updated successfully, but these errors were encountered: