Comments (9)
Can you check if the tokens are valid. I set up a fastapi with multi clients and it worked fine for me
from poe-api-wrapper.
Can you check if the tokens are valid. I set up a fastapi with multi clients and it worked fine for me
yes,I tried,they are valid when just single client. and also valid status on quora.com
from poe-api-wrapper.
Thats weird. Here are my fastapi set up, hope it can help you:
api.py
from fastapi import FastAPI
from fastapi import WebSocket
from poe_api_wrapper import PoeApi
clients = {}
app = FastAPI()
@app.get("/")
def index():
return {}
@app.websocket("/ws/{token}/{bot}/{message}")
async def send_message(websocket: WebSocket, token: str, bot: str, message: str):
await websocket.accept()
client = PoeApi(token)
for chunk in client.send_message(bot=bot, message=message):
await websocket.send_text(chunk['response'])
await websocket.close(code=1000)
client.py
import websocket
class Client():
def __init__(self, token, bot, message):
self.token = token
self.bot = bot
self.message = message
self.connect_to_websocket()
def on_message(self, ws, message):
print(message, end='', flush=True)
def on_close(self, ws):
print("WebSocket connection closed")
def connect_to_websocket(self):
self.message = self.message.replace(' ', '%20')
ws = websocket.WebSocketApp(
f'ws://127.0.0.1:8000/ws/{self.token}/{self.bot}/{self.message}',
on_message=self.on_message,
on_close=self.on_close
)
ws.run_forever()
# Example usage
client1 = Client("TOKEN_1", "a2", "Hello World")
client2 = Client("TOKEN_2", "a2", "Write a 500 word essay on Design Patterns")
client3 = Client("TOKEN_3", "chinchilla", "Write a simple snake game in Python")
Cmds:
uvicorn api:app --reload
then
python client.py
from poe-api-wrapper.
Uhm I wonder whats inside this function?
get_client(token)
from poe-api-wrapper.
Uhm I wonder whats inside this function?
get_client(token)
def get_client(token) -> PoeApi:
client_poe = PoeApi(token)
return client_poe
from poe-api-wrapper.
oh, the 2 tokens are invalid,but why?they seems valid on quora.com.
can u find out the reason?
from poe-api-wrapper.
Did you use different browser profiles for each client?
If no then the tokens should be unique for each browser profile.
Or you can try deleting the cookies and then login again
from poe-api-wrapper.
Did you use different browser profiles for each client? If no then the tokens should be unique for each browser profile. Or you can try deleting the cookies and then login again
oh,I think I found the reason, u must signin poe.com using the same email which registered on quora.com.
from poe-api-wrapper.
I think I will add this note to the document just in case
from poe-api-wrapper.
Related Issues (20)
- file attachments HOT 3
- New error? simplejson.errors.JSONDecodeError
- Bug on the result from poe --b BKEY --lat LATKEY
- it looks like api died. with the basic code below it doesn't work =/ HOT 1
- The server is down? Why SubscriptionMutation HOT 1
- Why the api is unstable right now HOT 6
- Issue on uploading txt files HOT 1
- Daily Limit Reached HOT 3
- Can I use the API_Key from poe directly? HOT 2
- Could it be converted to the OpenAI API format?
- With proxy, websocket error
- Could it be possible to support video file attachment
- Release 1.4.1, using Python 3.12.3 on MacOS, doesn't work HOT 2
- Error when uploading file with gemini_1_5_pro_1m HOT 1
- api still works? because I tried several ways here at home and it stopped working =/ HOT 1
- 16 message/day limit for Poe tokens ? HOT 1
- 代理问题 proxy problem
- where is quora.com/poe_api/gql_post ?
- ValueError: I/O operation on closed file problem. HOT 1
- gpt-4o has been updated in po, what is its code? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from poe-api-wrapper.