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

Method update_multilingual_glossary_name

deepl/deepl_client.py:238–264  ·  view source on GitHub ↗

Updates the name of a glossary with the provided name. :param glossary: GlossaryInfo or ID of glossary to update. :param name: The new name of the glossary :return: MultilingualGlossaryInfo containing information about updated glossary. :raises ValueErro

(
        self,
        glossary: Union[str, MultilingualGlossaryInfo],
        name: str,
    )

Source from the content-addressed store, hash-verified

236 return MultilingualGlossaryInfo.from_json(json)
237
238 def update_multilingual_glossary_name(
239 self,
240 glossary: Union[str, MultilingualGlossaryInfo],
241 name: str,
242 ) -> MultilingualGlossaryInfo:
243 """Updates the name of a glossary with the provided name.
244
245 :param glossary: GlossaryInfo or ID of glossary to update.
246 :param name: The new name of the glossary
247 :return: MultilingualGlossaryInfo containing information about updated
248 glossary.
249
250 :raises ValueError: If the name is empty or invalid.
251 :raises DeepLException: If the glossary cannot be found.
252 """
253 if not name:
254 raise ValueError("glossary name must not be empty")
255
256 if isinstance(glossary, MultilingualGlossaryInfo):
257 glossary = glossary.glossary_id
258 request_data = {"name": name}
259
260 status, content, json = self._api_call(
261 f"v3/glossaries/{glossary}", method="PATCH", json=request_data
262 )
263 self._raise_for_status(status, content, json, glossary=True)
264 return MultilingualGlossaryInfo.from_json(json)
265
266 def update_multilingual_glossary_dictionary(
267 self,

Callers 1

Calls 3

_api_callMethod · 0.80
_raise_for_statusMethod · 0.80
from_jsonMethod · 0.45

Tested by 1