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

Can not init Perplexity() #56

Open
phamxtien opened this issue Apr 21, 2024 · 4 comments
Open

Can not init Perplexity() #56

phamxtien opened this issue Apr 21, 2024 · 4 comments

Comments

@phamxtien
Copy link

phamxtien commented Apr 21, 2024

Today it returns error on perplexty = Perplexity()

It raise error on _get_sid() function
self.session.get(url=f"https://www.perplexity.ai/socket.io/?EIO=4&transport=polling&t={self.t}") >> Error 403

But this url is ok on browser: https://www.perplexity.ai/socket.io/?EIO=4&transport=polling&t=e68a195f

@Amm1rr
Copy link

Amm1rr commented Apr 21, 2024

No, I searched through many repositories and codes, but the core of all of them is from this repository, and nobody found a solution. I think the problem is with Cloudflare.
Welcome to any suggestions.

@phamxtien
Copy link
Author

Before, I just opened the browser and went to perplexity.ai then it worked fine but now it doesn't

@Amm1rr
Copy link

Amm1rr commented Apr 22, 2024

I move on to the next step, and now that I have the 'sid', I'm encountering an issue opening the WebSocket connection:

Error :

WebSocket error: Handshake status 403 Forbidden -+-+-

perplexity.py :

WebSocketApp(
            url=f"wss://www.perplexity.ai/socket.io/?EIO=4&transport=websocket&sid={self.sid}",
            header=self.user_agent,
            cookie=self._get_cookies_str(),
            on_open=on_open,
            on_message=on_message,
            on_error=lambda ws, err: print(f"websocket error: {err}")
        )

@phamxtien
Copy link
Author

Think it not pass cloudflare

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants