api.py 360 B

123456789101112
  1. class API:
  2. def call(self, **kwargs):
  3. return self.__call__(**kwargs)
  4. def __call__(self, **kwargs):
  5. search_kwargs = {'query': kwargs['query'], 'freshness': 'month'}
  6. search_res = self.search(**search_kwargs)
  7. return search_res
  8. @classmethod
  9. def search(cls, **kwargs) -> list[str]:
  10. raise NotImplementedError