API search() method fails silently for both anonymous and authenticated sessions #70
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug Description
The
perplexity.Client.search()method is currently non-functional. For both anonymous and authenticated (viacreate_account) sessions, the method returnsNonewhenstream=Falseor an empty generator whenstream=True.This appears to be caused by server-side changes at Perplexity that block the
POSTrequest tohttps://www.perplexity.ai/rest/sse/perplexity_ask. The request does not raise an exception but returns an empty response body, causing theiter_linesloop in thesearchmethod to yield no data.Steps to Reproduce
Anonymous search (fails):
Authenticated search (also fails):
emailnator.com.Expected Behavior
The
search()method should return a dictionary containing the search results from Perplexity.Actual Behavior
The
search()method returnsNonebecause the underlying request toperplexity_askreceives no data from the server, likely due to being blocked by anti-bot measures.Conclusion
The library appears to be outdated and requires an update to its
searchmethod to align with Perplexity's current API protection mechanisms. The request fingerprint or payload forperplexity_asklikely needs to be updated to mimic a legitimate browser request more closely.As I tested, returned status is 200, headers looks good, but body/content is empty
I can confirm experiencing the exact same issue. The problem occurs specifically when running from my Ubuntu server (both direct execution and via Docker Compose), while it works perfectly fine on my local machine.
Environment Details
/rest/sse/perplexity_askendpointTroubleshooting Attempts
I tried manually accessing Perplexity via browser using my server's IP address to pass Cloudflare challenge, but even after manual verification, the wrapper still returns 403 when executed from the same server IP.
Sample Error Log
Root Cause Analysis
Since
curl_cffiis already implemented in the code, the issue isn't TLS fingerprinting. This appears to be datacenter/server IP blocking. Cloudflare employs multiple detection layers:The same request with identical fingerprints succeeds from residential IPs but fails from hosting providers. This explains why local machine works but server deployment doesn't.
Potential Solutions
Has anyone tested with residential proxies or found workarounds for datacenter IP blocking?