Skip to content

Commit

Permalink
Use enum value for 'listing_type' in api calls
Browse files Browse the repository at this point in the history
The bug in the API calls for listing comments and posts within the 'lemmylib' library has been fixed. The 'type_' parameter key was previously incorrectly expecting the entire 'listing_type' enum instance, but it now correctly expects the 'value' attribute of the 'listing_type' enum instance.
  • Loading branch information
Pdzly committed Dec 18, 2023
1 parent 672f01e commit 86e2d0a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lemmylib/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def list_comments(self, page: int = 1, post_id: int | None = None, sort: LemmyPo
raise Exception("LemmyLib: Either post_id, community_id, community_name, user_id or user_name must be set")

return self.call_api(LemmyApiMethod.GET, f'comments', params={'page': page, 'post_id': post_id, 'sort': sort,
'type_': listing_type,
'type_': listing_type.value,
'parent_id': parent_id,
'community_id': community_id,
'community_name': community_name,
Expand All @@ -219,7 +219,7 @@ def list_posts(self,
self._logger.debug("LemmyLib list_posts")

return self.call_api(LemmyApiMethod.GET, f'posts',
params={'page_cursor': page_cursor, 'sort': sort, 'type_': listing_type,
params={'page_cursor': page_cursor, 'sort': sort, 'type_': listing_type.value,
'community_id': community_id,
'page': page,
'community_name': community_name,
Expand Down

0 comments on commit 86e2d0a

Please sign in to comment.