Skip to content

Commit 9583aa7

Browse files
Feature: add headers param to addTranslation method
1 parent 86d2dcc commit 9583aa7

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/lara_sdk/_translator.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,15 @@ def import_tmx(self, id_: str, tmx: str) -> MemoryImport:
172172
{'compression': 'gzip'}, {'tmx': compressed_stream}))
173173

174174
def add_translation(self, id_: Union[str, List[str]], source: str, target: str, sentence: str, translation: str,
175-
*, tuid: str = None, sentence_before: str = None, sentence_after: str = None) -> MemoryImport:
175+
*, tuid: str = None, sentence_before: str = None, sentence_after: str = None,
176+
headers: Optional[Dict[str, str]] = None) -> MemoryImport:
176177
body = {'source': source, 'target': target, 'sentence': sentence, 'translation': translation,
177178
'tuid': tuid, 'sentence_before': sentence_before, 'sentence_after': sentence_after}
178179

179180
if isinstance(id_, list):
180181
body['ids'] = id_
181-
return MemoryImport(**self._client.put('/memories/content', body))
182-
return MemoryImport(**self._client.put(f'/memories/{id_}/content', body))
182+
return MemoryImport(**self._client.put('/memories/content', body, headers=headers))
183+
return MemoryImport(**self._client.put(f'/memories/{id_}/content', body, headers=headers))
183184

184185
def delete_translation(self, id_: Union[str, List[str]], source: str, target: str, sentence: str, translation: str,
185186
*, tuid: str = None, sentence_before: str = None, sentence_after: str = None

0 commit comments

Comments
 (0)