Prepare an API request by adding the necessary authentication - header, bearer token, etc.
(self, url, kwargs)
| 1248 | yield line |
| 1249 | |
| 1250 | def prepare_api_request(self, url, kwargs): |
| 1251 | """ |
| 1252 | Prepare an API request by adding the necessary authentication - header, bearer token, etc. |
| 1253 | """ |
| 1254 | if self.api_key: |
| 1255 | url = url.format(api_key=self.api_key) |
| 1256 | if "headers" not in kwargs: |
| 1257 | kwargs["headers"] = {} |
| 1258 | kwargs["headers"]["Authorization"] = f"Bearer {self.api_key}" |
| 1259 | return url, kwargs |
| 1260 | |
| 1261 | async def api_request(self, *args, **kwargs): |
| 1262 | """ |
no test coverage detected