Skip to content

Commit

Permalink
Merge pull request #106 from adrian-valente/master
Browse files Browse the repository at this point in the history
Update deepl.py
  • Loading branch information
terryyin authored Oct 22, 2023
2 parents 67774e2 + ae60691 commit 2f099e1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions translate/providers/deepl.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ def __init__(self, **kwargs):
super(DeeplProvider, self).__init__(**kwargs)
self.pro = self.kwargs.get('pro', False)
self.base_url = self.base_pro_url if self.pro else self.base_free_url

self.headers.update({'Authorization': f'DeepL-Auth-Key {self.secret_access_key}'})

def _make_request(self, text):
params = {
'auth_key': self.secret_access_key,
'target_lang': self.to_lang,
'text': text
}
Expand All @@ -39,7 +39,7 @@ def _make_request(self, text):

if self.session is None:
self.session = requests.Session()
response = self.session.post(self.base_url, params=params, headers=self.headers, json=[{}])
response = self.session.post(self.base_url, params=params, headers=self.headers)
response.raise_for_status()
return json.loads(response.text)

Expand Down

0 comments on commit 2f099e1

Please sign in to comment.