def get(self, api_key): """ Validate an API Key Calling mailgun, validate the API key --- tags: - User parameters: - in: path name: api_key description: API Key type: string required: true responses: 200: description: The token is valid """ try: mailgun.list_domains(api_key) return {"api_key": api_key, "valid": True} except: return {"api_key": api_key, "valid": False}
def get(self, api_key): """ List domains This route lists all domains the user has access to see --- tags: - Domains parameters: - in: header name: X-Auth-Token description: Mailgun token type: string required: true responses: 401: {} 200: description: A list of domains is returned """ domains = mailgun.list_domains(api_key) return {"domains": domains, "total": len(domains)}