A Simple Selenium Based Python Library For Quora`s Poe.com
Project description
PoePT
PoePT is a simple Selenium Python package that provides automation for interacting with the Poe chatbots. Giving you access to multiple chatbots like:
- Assistant
- ChatGPT-3
- ChatGPT-4
- Gemini
- Bard
- Claude-Instant
Installation
You can install PoePT using pip:
py -m pip install poept -U
or
py -m pip install git+https://github.com/Saikyo0/poept@main
Requirements:
- a POE account (make one at poe.com)
- Chrome
Usage
Here's an example of how to use PoePT to log in to the Poe chatbot and ask a question:
- create connection with bot
- login is needed every time but will only ask for code if you havent logged in before
from poept import PoePT
bot = PoePT()
bot.login("your_email@example.com")
- Once you're logged in, you can ask a question to the chatbot of your choice and retrieve the result
result = bot.ask(newchat=False, bot="Assistant", prompt="hello")
print(result)
- the
newchat
parameter is used for either staying in the same chat for upcoming prompts or making new chat, but its ignored on the first question - When you're done with your session, be sure to close the connection:
bot.close()
Examples: link
Extra
- status of client
status = bot.status
Status | Meanings |
---|---|
false | the bot isn't connected and cant answer |
ready | the bot is connected and ready to answer |
wait | the bot is generating an answer |
- Get Live Updating Result
from poept import PoePT
import threading
bot = PoePT()
bot.login("<email>@gmail.com")
prompt = "Write A Lorem Ipsum"
def ask_bot():
print("> "+prompt)
bot.ask(bot="Assistant", prompt=prompt)
threading.Thread(target=ask_bot).start()
while True:
if bot.prompt == prompt:
if bot.status == "wait":
print(bot.status)
print('\r' + bot.response, end='')
elif bot.status == "ready":
break
- Image Response
prompt = "An Apple"
result = bot.ask(bot="StableDiffusion3-2B", prompt=prompt, img_output=True)
print(result)
- Live voice Input
print("Listening...")
prompt = bot.live_voice(timeout=4)
print("Recording complete.")
result = bot.ask(bot="Assistant", prompt=prompt)
print("\nresponse:", result)
- File voice Input
audio_file = os.path.abspath("audio.wav")
prompt = bot.file_voice(audio_file)
result = bot.ask(newchat=False, bot="Assistant", prompt=prompt)
print("\nresponse:", result)
- Cookie control
- default cookies path:
./saved_cookies/cookies.txt
bot.clear_cookies()
bot.load_cookies("path")
- configure classes and keys
bot.config(self, website="https://poe.com/", #Base URL of POE.
email_form=".textInput_input__9YpqY", #CSS selector for the email input form.
go_btn=".Button_buttonBase__Bv9Vx.Button_primary__6UIn0", #CSS selector for the 'Go' button.
code_form=".VerificationCodeInput_verificationCodeInput__RgX85", #CSS selector for the verification code input div.
login_btn=".Button_buttonBase__Bv9Vx.Button_primary__6UIn0", #CSS selector for the login button.
query_input_form=".GrowingTextArea_textArea__ZWQbP", #CSS selector for the chat input div.
query_send_btn=".ChatMessageSendButton_sendButton__4ZyI4", #CSS selector for the chat send button.
clear_key_btn=".ChatBreakButton_button__zyEye", #CSS selector for the clear chat button.
file_input_form=".ChatMessageFileInputButton_input__svNx4", #CSS selector for the file input div.
file_input_box=".ChatMessageInputAttachments_container__AAxGu", #CSS selector for the file input box in chat.
voice_input_btn=".ChatMessageVoiceInputButton_button__NjXno", #CSS selector for the voice input button.
msg_element=".ChatMessage_chatMessage__xkgHx", #CSS selector for the response message element div.
):
Contributing
If you encounter a bug open an issue on the GitHub repository. Pull requests are also welcome!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
poept-0.3.1.tar.gz
(18.9 kB
view hashes)