Get posts by userprofile
This commit is contained in:
parent
6c69c6d6c8
commit
3188595f4a
3 changed files with 20 additions and 2 deletions
|
|
@ -3,7 +3,8 @@ def get(API, post_slug: str,) -> dict:
|
|||
Fetches the post data from the API.
|
||||
|
||||
Args:
|
||||
post_slug (str): Slug of the post to fetch.
|
||||
post_slug (str): Slug of the post to fetch data for.
|
||||
|
||||
Returns:
|
||||
dict: The post data.
|
||||
"""
|
||||
|
|
|
|||
14
jobs/post/listbyuserprofile.py
Normal file
14
jobs/post/listbyuserprofile.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
def listbyuserprofile(API, user_slug: str,) -> dict:
|
||||
"""
|
||||
Fetches the list of posts for a given user profile from the API.
|
||||
|
||||
Args:
|
||||
user_slug (str): Slug of the user profile to fetch posts for.
|
||||
Returns:
|
||||
dict: The list of posts for the user profile.
|
||||
"""
|
||||
print(f"Fetching posts for user profile: {user_slug}")
|
||||
# Note there is actually a reference to `/branch` in the API url
|
||||
# and it should be considered for removal because that's confusing
|
||||
post_list = API.make_request("GET", "content", f"post/ref-userprofile/branch/{user_slug}", authenticate=True)
|
||||
return post_list
|
||||
|
|
@ -40,5 +40,8 @@ if not API.is_token_valid():
|
|||
# post = API.run_job('post.get', "1774875037-170a46a9")
|
||||
# print(post)
|
||||
# print("-----------------------------")
|
||||
feed = API.run_job('post.listbybranch', "music")
|
||||
# feed = API.run_job('post.listbybranch', "music")
|
||||
# print(feed)
|
||||
print("-----------------------------")
|
||||
feed = API.run_job('post.listbyuserprofile', "simon-little")
|
||||
print(feed)
|
||||
Loading…
Add table
Add a link
Reference in a new issue