Skip to content

Commit

Permalink
ruff fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pamelafox committed Jan 2, 2024
1 parent 5ce31f7 commit b6a0993
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ def translate_with_azure(text, from_lang, to_lang):

request = requests.post(url, params=params, headers=headers, json=body)
response = request.json()
if (type(response) is dict) and (err := response.get("error", None)):
if isinstance(response, dict) and (err := response.get("error", None)):
return None, err["message"], "AZURE"
return response[0]["translations"][0]["text"], None, "AZURE"

0 comments on commit b6a0993

Please sign in to comment.