As of June 23, multiple glossaries should be supported by the v2/translate API. However, the Python library currently does not seem support that (using the latest version 1.30.0).
Simply using a list of IDs in the glossary paremeter expectedly raises an exception:
deepl.exceptions.DeepLException: Bad request, message: Value for 'glossary_id' not supported.
To work around that I've simply added a new check in the _check_language_and_formality method:
class Translator:
def _check_language_and_formality[...]
if isinstance(glossary, list):
request_data["glossary_ids"] = glossary
elif isinstance(glossary, GlossaryInfo) or isinstance(
glossary, MultilingualGlossaryInfo
):
request_data["glossary_id"] = glossary.glossary_id
elif glossary is not None:
request_data["glossary_id"] = glossary
[...]
The API is happy to process the request afterwards :)
As of June 23, multiple glossaries should be supported by the v2/translate API. However, the Python library currently does not seem support that (using the latest version 1.30.0).
Simply using a list of IDs in the glossary paremeter expectedly raises an exception:
deepl.exceptions.DeepLException: Bad request, message: Value for 'glossary_id' not supported.To work around that I've simply added a new check in the
_check_language_and_formalitymethod:The API is happy to process the request afterwards :)