Fix public

Add guest alternative
Write some doc
This commit is contained in:
simonwt 2026-04-09 00:34:23 +01:00
parent eabca3e7bf
commit ae6ee7e7a0
4 changed files with 94 additions and 16 deletions

View file

@ -61,13 +61,16 @@ class APIClient(BaseModel):
url += f"?{urlencode(query_params)}"
# Set up headers for the request
headers = {
"Content-Type": "application/json",
}
# Add the Authorization header with the access token if authentication is required
if authenticate:
token = self._access_token
headers["Authorization"] = f"Bearer {token}"
else:
token = 'guest'
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {token}"
}
# Debugging output to show the request details before making the API call
if self.debug:

View file

@ -7,5 +7,5 @@ def listpublic(API, lastEvaluatedKey=None) -> dict:
Returns:
dict: The list of public posts.
"""
post_list = API.make_request("GET", "content", f"post/public", authenticate=True, query_params=lastEvaluatedKey)
post_list = API.make_request("GET", "content", f"public/posts", authenticate=False, query_params=lastEvaluatedKey)
return post_list