Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client.purge_conversation count doesn't work properly #103

Open
ramazk opened this issue Feb 6, 2024 · 0 comments
Open

client.purge_conversation count doesn't work properly #103

ramazk opened this issue Feb 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ramazk
Copy link

ramazk commented Feb 6, 2024

When I run client.purge_conversation(bot, chatCode=chunk["chatCode"], count=1) it hangs until I stop/kill the process, also it in the loop trying to delete not only one last message but all of them one by one, and even after it delete all existing messages it still hangs.

>>> client.get_previous_messages(bot, chatCode=chunk["chatCode"])
2024-02-06 14:18:29.321 | INFO     | poe_api_wrapper.api:get_previous_messages:1054 - Found 0 messages of 20p5w9mrep4lru436q1
[]
>>> for chunk in client.send_message(bot, message, chatCode=chunk["chatCode"]): pass
... 
>>> for chunk in client.send_message(bot, message, chatCode=chunk["chatCode"]): pass
... 
>>> for chunk in client.send_message(bot, message, chatCode=chunk["chatCode"]): pass
... 
>>> for chunk in client.send_message(bot, message, chatCode=chunk["chatCode"]): pass
... 
>>> for chunk in client.send_message(bot, message, chatCode=chunk["chatCode"]): pass
... 
>>> len(client.get_previous_messages(bot, chatCode=chunk["chatCode"]))
2024-02-06 14:19:46.936 | INFO     | poe_api_wrapper.api:get_previous_messages:1054 - Found 10 messages of 20p5w9mrep4lru436q1
10
>>> client.purge_conversation(bot, chatCode=chunk["chatCode"], count=1)
^CTraceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ramazk/Python/test/venv/lib/python3.11/site-packages/poe_api_wrapper/api.py", line 953, in purge_conversation
    self.delete_message(message_ids)
  File "/Users/ramazk/Python/test/venv/lib/python3.11/site-packages/poe_api_wrapper/api.py", line 920, in delete_message
    self.send_request('gql_POST', 'DeleteMessageMutation', variables)
  File "/Users/ramazk/Python/test/venv/lib/python3.11/site-packages/poe_api_wrapper/api.py", line 187, in send_request
    response = self.client.post(f'{self.BASE_URL}/poe_api/{path}', content=payload, headers=headers)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ramazk/Python/test/venv/lib/python3.11/site-packages/httpx/_client.py", line 1146, in post
    return self.request(
           ^^^^^^^^^^^^^
  File "/Users/ramazk/Python/test/venv/lib/python3.11/site-packages/httpx/_client.py", line 828, in request
    return self.send(request, auth=auth, follow_redirects=follow_redirects)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ramazk/Python/test/venv/lib/python3.11/site-packages/httpx/_client.py", line 915, in send
    response = self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ramazk/Python/test/venv/lib/python3.11/site-packages/httpx/_client.py", line 943, in _send_handling_auth
    response = self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ramazk/Python/test/venv/lib/python3.11/site-packages/httpx/_client.py", line 980, in _send_handling_redirects
    response = self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ramazk/Python/test/venv/lib/python3.11/site-packages/httpx/_client.py", line 1016, in _send_single_request
    response = transport.handle_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ramazk/Python/test/venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 231, in handle_request
    resp = self._pool.handle_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ramazk/Python/test/venv/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 268, in handle_request
    raise exc
  File "/Users/ramazk/Python/test/venv/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 251, in handle_request
    response = connection.handle_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ramazk/Python/test/venv/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 103, in handle_request
    return self._connection.handle_request(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ramazk/Python/test/venv/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 133, in handle_request
    raise exc
  File "/Users/ramazk/Python/test/venv/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 111, in handle_request
    ) = self._receive_response_headers(**kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ramazk/Python/test/venv/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 176, in _receive_response_headers
    event = self._receive_event(timeout=timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ramazk/Python/test/venv/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 212, in _receive_event
    data = self._network_stream.read(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ramazk/Python/test/venv/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 126, in read
    return self._sock.recv(max_bytes)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 1296, in recv
    return self.read(buflen)
           ^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 1169, in read
    return self._sslobj.read(len)
           ^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt
>>> len(client.get_previous_messages(bot, chatCode=chunk["chatCode"]))
2024-02-06 14:20:23.641 | INFO     | poe_api_wrapper.api:get_previous_messages:1054 - Found 5 messages of 20p5w9mrep4lru436q1
5

With client.purge_conversation(bot, chatCode=chunk["chatCode"], del_all=True) everything is fine, it works as expected.

@snowby666 snowby666 added the bug Something isn't working label Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants