diff --git a/predicthq/endpoints/decorators.py b/predicthq/endpoints/decorators.py index 0fc8fcc..5ff425b 100644 --- a/predicthq/endpoints/decorators.py +++ b/predicthq/endpoints/decorators.py @@ -89,6 +89,7 @@ def wrapper(endpoint, *args, **kwargs): loaded_model = model(**data) loaded_model._more = functools.partial(wrapper, endpoint) loaded_model._endpoint = endpoint + # This is a temporary solution to get the next page for Features API if hasattr(loaded_model, "_kwargs"): loaded_model._kwargs = kwargs return loaded_model diff --git a/predicthq/endpoints/schemas.py b/predicthq/endpoints/schemas.py index 9417466..b66124b 100644 --- a/predicthq/endpoints/schemas.py +++ b/predicthq/endpoints/schemas.py @@ -32,6 +32,8 @@ def get_next(self): if not self.has_next() or not hasattr(self, "_more"): return params = self._parse_params(self.next) + # This is a temporary solution to get the next page for Features API + # where the post request requires a json body as well as query params if kwargs := getattr(self, "_kwargs", {}): return self._more(_params=params, _json=kwargs.get("_json", {}) or kwargs) return self._more(**params) diff --git a/predicthq/endpoints/v1/features/endpoint.py b/predicthq/endpoints/v1/features/endpoint.py index a9ea9fa..724189d 100644 --- a/predicthq/endpoints/v1/features/endpoint.py +++ b/predicthq/endpoints/v1/features/endpoint.py @@ -25,6 +25,8 @@ def mutate_bool_to_default_for_type(cls, user_request_spec): @accepts(query_string=False) @returns(FeatureResultSet) + # This is a temporary solution to get the next page for Features API + # _params and _json are for internal use only def obtain_features(self, _params: dict = None, _json: dict = None, **request): verify_ssl = request.pop("config", {}).get("verify_ssl", True) return self.client.post( diff --git a/predicthq/endpoints/v1/features/schemas.py b/predicthq/endpoints/v1/features/schemas.py index 2d0ee5a..cdbb32a 100644 --- a/predicthq/endpoints/v1/features/schemas.py +++ b/predicthq/endpoints/v1/features/schemas.py @@ -59,5 +59,5 @@ def __getattr__(self, name: str) -> Union[date, FeatureStat, FeatureRankLevel]: class FeatureResultSet(ResultSet, CsvMixin): - _kwargs: Optional[Dict] = None + _kwargs: Optional[Dict] = None # temporary solution to get the next page results: List[Optional[Feature]]