@@ -70,6 +70,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7070- ` translate_text() ` accepts ` source_lang ` and ` target_lang ` positionally after
7171 the text, for example ` translate_text("Hello", None, "DE") ` . Keyword use is
7272 unchanged; omitting ` target_lang ` still raises ` TypeError ` .
73+ - Added the ` document_id ` property to ` DocumentStatus ` , read from the status
74+ response of ` translate_document_get_status() ` (falling back to the handle's
75+ document ID).
76+ - ` translate_document() ` , ` translate_document_from_filepath() ` and
77+ ` translate_document_upload() ` now also accept ` source_lang ` and
78+ ` target_lang ` as positional arguments after the input (and output)
79+ arguments, for example ` translate_document_upload(file, "EN", "DE") ` .
80+ Keyword use is unchanged.
7381
7482### Changed
7583- HTTP 404 responses raise ` NotFoundException ` instead of ` DeepLException `
@@ -89,6 +97,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8997 ` download_translation_memory_export() ` is now 64 KiB instead of 1 byte, so
9098 downloads into ` output_file ` no longer write one byte per call. The written
9199 content is unchanged; an explicit ` chunk_size ` still applies.
100+ - ` DocumentStatus.status ` is now typed ` Union[DocumentStatus.Status, str] ` : a
101+ status value the API returns that this version does not know is kept as a
102+ string instead of raising ` ValueError ` . Type-checked code that reads
103+ ` status.status.value ` may need an ` isinstance(..., DocumentStatus.Status) `
104+ guard; ` str(status) ` returns the status string in both cases.
105+ - ` translate_document_wait_until_done() ` now raises ` DeepLException ` with the
106+ API's error message when the document translation fails, instead of
107+ returning the ` DocumentStatus ` with status ` error ` .
108+ - ` translate_document() ` and ` translate_document_from_filepath() ` now also
109+ wrap upload failures in ` DocumentTranslationException ` , with
110+ ` document_handle ` set to ` None ` and the original exception as ` __cause__ ` .
111+ Invalid arguments still raise ` ValueError ` or ` TypeError ` .
92112
93113### Deprecated
94114- ` Translator ` is deprecated in favour of ` DeepLClient ` , which supports all its
@@ -140,6 +160,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
140160 ` None ` in that case.
141161- Fixed ` translate_text() ` raising ` IndexError ` when the response holds fewer
142162 translations than texts sent. It now raises ` DeepLException ` .
163+ - Fixed ` translate_document_get_status() ` raising ` ValueError ` and
164+ ` translate_document_wait_until_done() ` stopping when the API returns a
165+ document status this version does not know. ` DocumentStatus.status ` keeps
166+ such a status as a string, and polling continues.
167+ - Fixed ` translate_document() ` and ` translate_document_from_filepath() `
168+ sending ` formality=default ` when ` formality ` was not set. It is now sent
169+ only when given.
170+ - Fixed ` translate_document_get_status() ` and ` translate_document_download() `
171+ not URL-encoding the document ID in the request path.
172+ - Fixed ` translate_document_upload() ` returning an empty ` DocumentHandle ` when
173+ the response lacks ` document_id ` or ` document_key ` , and raising
174+ ` AttributeError ` when the response body is not a JSON object. Both now
175+ raise ` DeepLException ` .
176+ - Fixed the type annotation of ` DocumentStatus.error_message ` , which is a
177+ string, not an integer.
143178- Fixed the ` DeprecationWarning ` messages of ` Usage.Detail.limit_exceeded ` and
144179 ` Usage.any_limit_exceeded ` , which named the replacement instead of the
145180 deprecated property. They now read "limit_exceeded is deprecated, use
0 commit comments