MCPcopy Create free account
hub / github.com/DeepL/deepl-python / get_glossary_languages

Method get_glossary_languages

deepl/translator.py:1012–1030  ·  view source on GitHub ↗

Request the list of language pairs supported for glossaries.

(self)

Source from the content-addressed store, hash-verified

1010 ]
1011
1012 def get_glossary_languages(self) -> List[GlossaryLanguagePair]:
1013 """Request the list of language pairs supported for glossaries."""
1014 status, content, json = self._api_call(
1015 "v2/glossary-language-pairs", method="GET"
1016 )
1017
1018 self._raise_for_status(status, content, json)
1019
1020 supported_languages = (
1021 json.get("supported_languages", [])
1022 if (json and isinstance(json, dict))
1023 else []
1024 )
1025 return [
1026 GlossaryLanguagePair(
1027 language_pair["source_lang"], language_pair["target_lang"]
1028 )
1029 for language_pair in supported_languages
1030 ]
1031
1032 def get_usage(self) -> Usage:
1033 """Requests the current API usage."""

Callers 2

action_languagesFunction · 0.80
test_glossary_languagesFunction · 0.80

Calls 3

_api_callMethod · 0.95
_raise_for_statusMethod · 0.95

Tested by 1

test_glossary_languagesFunction · 0.64