(self, credentials: BundleCredentials)
| 8 | |
| 9 | class Serper(BundleHandler): |
| 10 | async def verify(self, credentials: BundleCredentials): |
| 11 | query: str = "TaskingAI" |
| 12 | SERPER_API_KEY: str = credentials.credentials.get("SERPER_API_KEY") |
| 13 | |
| 14 | url = "https://google.serper.dev/search" |
| 15 | |
| 16 | headers = {"X-API-KEY": SERPER_API_KEY, "Content-Type": "application/json"} |
| 17 | |
| 18 | payload = json.dumps({"q": query, "num": 20}) |
| 19 | |
| 20 | async with ClientSession() as session: |
| 21 | async with session.post(url, headers=headers, data=payload, proxy=CONFIG.PROXY) as response: |
| 22 | if response.status != 200: |
| 23 | raise_credentials_validation_error(await response.text()) |
nothing calls this directly
no test coverage detected