-
Notifications
You must be signed in to change notification settings - Fork 316
Add 'RECV_POST' after sending message. #125
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The entire file was converted from 2 spaces to 4. Please revert this.
examples/example.py
Outdated
import logging | ||
|
||
poe.logger.setLevel(logging.INFO) | ||
client = poe.Client("SqX7oTPz0qV1GKgkLEsCmA%3D%3D") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't hardcode your Poe token here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lmao
examples/example.py
Outdated
import time | ||
|
||
request = 300 | ||
wait_time = 600 / request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it'd be better to add the wait functionality to examples/repeated_messages.py
instead of creating a new file.
examples/poe.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this a completely new file instead of editing the original poe-api/src/poe.py
?
To ensure a smooth merging process, it is necessary to have a test beforehand. |
self.request_count += 1 | ||
|
||
# send recv_post after receiving the last message | ||
if self.request_count % 3 == 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this is a 1/3 chance even though the regular Poe web client sends a receive_POST after every message.
@@ -518,6 +550,27 @@ def send_message(self, chatbot, message, with_chat_break=False, timeout=20): | |||
message_id = message["messageId"] | |||
|
|||
yield message | |||
|
|||
# wait 2 senconds after sending the request | |||
time.sleep(2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems kind of pointless to make all the waiting in this function be blocking. This could easily be moved to a new thread. I'll probably implement that on my own though.
Details are shown in #118
In new_poe.py, I change generate_payload, send_query, send_message function. (I just add 'RECV_POST' in the send_message function)
In test.py, 600 samples, 1s interval.