Get a client from the pool and return it as a context manager.
(self, *arg, **kwargs)
| 273 | random.shuffle(self.queue) |
| 274 | |
| 275 | def __enter__(self, *arg, **kwargs) -> ClientArgs: |
| 276 | """Get a client from the pool and return it as a context manager.""" |
| 277 | |
| 278 | if len(self) == 0: |
| 279 | raise APIKeyPoolEmptyError("api key pool is empty") |
| 280 | |
| 281 | return self.queue[self._index].client_args |
| 282 | |
| 283 | def __exit__(self, exc_type, exc_value, exc_traceback) -> bool: |
| 284 | """Put the resource back in the pool.""" |
nothing calls this directly
no test coverage detected