Skip to content

Commit

Permalink
add comment regarding features-api
Browse files Browse the repository at this point in the history
  • Loading branch information
Keegan Cordeiro committed Jan 17, 2025
1 parent b2741fd commit 7d82bc9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions predicthq/endpoints/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions predicthq/endpoints/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions predicthq/endpoints/v1/features/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion predicthq/endpoints/v1/features/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]

0 comments on commit 7d82bc9

Please sign in to comment.