nathanrchn / perplexityai

A python api to use perplexity.ai
233 stars 60 forks source link

Stuck in search function #22

Closed lixiaochuan2020 closed 1 year ago

lixiaochuan2020 commented 1 year ago

My codes are like: """ 1 from perplexity import Perplexity 2 perplexity = Perplexity() 3 answer = perplexity.search("What is the meaning of life?") 4 for a in answer: 5 print(a) 6 perplexity.close() """ When I run this, it just stuck in line 3, which is "search" function. After a long time, I will get this error message: websocket error: [Errno 60] Operation timed out. Is there any solution?

nathanrchn commented 1 year ago

There is surely a problem with your network. Do you use a proxy?

lixiaochuan2020 commented 1 year ago

Yes, if I do not use a proxy, I will get this error:

CleanShot 2023-10-09 at 20 06 01@2x
lixiaochuan2020 commented 1 year ago

After setting the proxy in code by 'os.environ["http"] & ["https"] ', it wors now!