MCPcopy Create free account
hub / github.com/dialect-app/dialect / validate_api_key

Method validate_api_key

dialect/providers/modules/libretrans.py:71–84  ·  view source on GitHub ↗
(self, key)

Source from the content-addressed store, hash-verified

69 return valid
70
71 async def validate_api_key(self, key):
72 # Form data
73 data = {
74 "q": "hello",
75 "api_key": key,
76 }
77
78 try:
79 response = await self.post(self.detect_url, data, form=True)
80 return "confidence" in response[0]
81 except (APIKeyInvalid, APIKeyRequired):
82 return False
83 except Exception:
84 raise
85
86 async def init_trans(self):
87 languages = await self.get(self.lang_url)

Callers

nothing calls this directly

Calls 1

postMethod · 0.80

Tested by

no test coverage detected