Description
The current hash for ChatListPaginationQuery in queries.py is causing "PersistedQueryNotFound" errors when fetching historical messages of a chat using the get_previous_messages() method. This issue prevents users from retrieving older messages from a chat thread.
Steps to Reproduce
- Use the
get_previous_messages() method to fetch historical messages from a chat thread.
- Observe the "PersistedQueryNotFound" error in the response.
Here’s a code sample to reproduce the issue:
from poe_api_wrapper import PoeApi
# Initialize the client with tokens
tokens = {
'p-b': 'YOUR_P_B_COOKIE',
'p-lat': 'YOUR_P_LAT_COOKIE',
}
client = PoeApi(tokens=tokens)
try:
# Fetch the first chat from the chat history
chat_history = client.get_chat_history(count=1)
if chat_history['data']:
# Get the first bot and its chat code
bot_key = list(chat_history['data'].keys())[0]
chat_code = chat_history['data'][bot_key][0]['chatCode']
# Attempt to retrieve all messages from the chat
print(f"Fetching messages for chat: {chat_code}")
messages = client.get_previous_messages(
bot=bot_key,
chatCode=chat_code,
get_all=True
)
print(f"Successfully retrieved {len(messages)} messages.")
except Exception as e:
print(f"Error: {str(e)}")
Expected Behavior
The get_previous_messages() method should successfully fetch and paginate through historical messages without errors.
Actual Behavior
The method fails with a "PersistedQueryNotFound" error due to an outdated hash value for ChatListPaginationQuery.
Proposed Solution
Update the hash value for ChatListPaginationQuery in queries.py to resolve the issue. This fix has already been implemented in PR #221.
Linked PR
[PR #221: Fix: Update ChatListPaginationQuery hash to resolve pagination errors](#221)
Temporary Workaround
Manually update the ChatListPaginationQuery hash in queries.py to "c1a8fd96dd6e0a4679814182951b1e256e175587513c81b223addf931833a692".
Impact
This fix ensures successful pagination requests and maintains compatibility with the current Poe API GraphQL endpoint.
Description
The current hash for
ChatListPaginationQueryinqueries.pyis causing "PersistedQueryNotFound" errors when fetching historical messages of a chat using theget_previous_messages()method. This issue prevents users from retrieving older messages from a chat thread.Steps to Reproduce
get_previous_messages()method to fetch historical messages from a chat thread.Here’s a code sample to reproduce the issue:
Expected Behavior
The
get_previous_messages()method should successfully fetch and paginate through historical messages without errors.Actual Behavior
The method fails with a "PersistedQueryNotFound" error due to an outdated hash value for
ChatListPaginationQuery.Proposed Solution
Update the hash value for
ChatListPaginationQueryinqueries.pyto resolve the issue. This fix has already been implemented in PR #221.Linked PR
[PR #221: Fix: Update ChatListPaginationQuery hash to resolve pagination errors](#221)
Temporary Workaround
Manually update the
ChatListPaginationQueryhash inqueries.pyto "c1a8fd96dd6e0a4679814182951b1e256e175587513c81b223addf931833a692".Impact
This fix ensures successful pagination requests and maintains compatibility with the current Poe API GraphQL endpoint.