| 18 | return url, kwargs |
| 19 | |
| 20 | async def setup(self): |
| 21 | await super().setup() |
| 22 | self.headers = {} |
| 23 | api_keys = set() |
| 24 | modules_config = self.scan.config.get("modules", {}) |
| 25 | git_modules = [m for m in modules_config if str(m).startswith("git")] |
| 26 | for module_name in git_modules: |
| 27 | module_config = modules_config.get(module_name, {}) |
| 28 | api_key = module_config.get("api_key", "") |
| 29 | if isinstance(api_key, str): |
| 30 | api_key = [api_key] |
| 31 | for key in api_key: |
| 32 | key = key.strip() |
| 33 | if key: |
| 34 | api_keys.add(key) |
| 35 | if not api_keys: |
| 36 | if self.auth_required: |
| 37 | return None, "No API key set" |
| 38 | self.api_key = api_keys |
| 39 | try: |
| 40 | await self.ping() |
| 41 | self.hugesuccess("API is ready") |
| 42 | return True |
| 43 | except Exception as e: |
| 44 | self.trace(traceback.format_exc()) |
| 45 | return None, f"Error with API ({str(e).strip()})" |
| 46 | return True |
| 47 | |
| 48 | async def github_graphql_request(self, graphql_query, resp_key): |
| 49 | url = f"{self.base_url}/graphql" |