Skip to content

Commit

Permalink
fix api payload in Bokmal to Nynorsk Translate Macro [SDNTB-875] (#513)
Browse files Browse the repository at this point in the history
* fix api payload in Bokmal to Nynorsk Translate Macro [SDNTB-875]

* add timeout
  • Loading branch information
devketanpro authored Nov 5, 2024
1 parent 46884e9 commit a80d5d6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/ntb/macros/nob_NO_translate_macro.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@


def nob_NO_translate_macro(item, **kwargs):
preference_params = {k: True for k in get_user_preference_params()}
preference_params = (
{k: True for k in get_user_preference_params()}
if get_user_preference_params()
else {}
)

token = app.config.get("OMSETT_API_TOKEN", "")

Expand All @@ -36,7 +40,7 @@ def nob_NO_translate_macro(item, **kwargs):
"fileType": "html",
}

r = requests.post("https://nynorsk.cloud/translate", data=data, timeout=(10, 30))
r = requests.post("https://nynorsk.cloud/translate", json=data, timeout=(10, 30))

if r.status_code == 200:
item.update(r.json())
Expand Down

0 comments on commit a80d5d6

Please sign in to comment.