Comments (12)
他的默认代理检测器找不到clash代理,需要修改他的代码,分为两部分:
- http代理:修改api.py的
__init__
如下:
def __init__(self, cookie: str, proxy: bool=False):
self.cookie = cookie
self.formkey = None
if proxy == True and PROXY == True:
# proxies = fetch_proxy()
# for p in range(len(proxies)):
try:
self.proxy = {
"http://": "socks5://127.0.0.1:7890",
"https://": "socks5://127.0.0.1:7890",
}
self.client = Client(headers=self.HEADERS, timeout=180, proxies=self.proxy)
# logger.info(f"Connection established with {proxies[p]}")
logger.info("代理连接成功")
# break
except:
# logger.info(f"Connection failed with {proxies[p]}. Trying {p+1}/{len(proxies)} ...")
logger.error("代理错误")
sleep(1)
else:
self.proxy = None
self.client = Client(headers=self.HEADERS, timeout=180)
self.client.cookies.update({'m-b': self.cookie})
self.get_channel_settings()
logger.info("Connection established with poe.com")
self.ws_connecting = False
self.ws_connected = False
self.ws_error = False
self.active_messages = {}
self.message_queues = {}
self.current_thread = {}
self.retry_attempts = 3
self.message_generating = True
self.ws_refresh = 3
self.groups = {}
self.connect_ws()
- websocket代理:修改api.py的
ws_run_thread
函数如下:
def ws_run_thread(self):
if not self.ws.sock:
kwargs = {"sslopt": {"cert_reqs": ssl.CERT_NONE}, "http_proxy_host":"127.0.0.1", "http_proxy_port": 10808, "proxy_type": "socks5"}
self.ws.run_forever(**kwargs)
这个方法对我好用
from poe-api-wrapper.
I installed poe_api_wrapper[proxy]. My operating system is Win11, and the Python version is 3.9.12
from poe-api-wrapper.
Well there was no proxy at that moment. My unit test still works
from poe-api-wrapper.
Did you enable Clash or other proxy software when testing? I keep Clash on when running the sample code. If I turn off Clash, I can't access Poe.com.
from poe-api-wrapper.
from poe-api-wrapper.
i cant help beyond that then since it depends on ballyregan for auto-proxy method. Can you use the lib with just client = PoeApi(token)
?
from poe-api-wrapper.
I still can't use it.
client = PoeApi(token)
File "C:\Users\cao\AppData\Roaming\Python\Python39\site-packages\poe_api_wrapper\api.py", line 124, in init
'Quora-Formkey': self.get_formkey,
File "C:\Users\cao\AppData\Roaming\Python\Python39\site-packages\poe_api_wrapper\api.py", line 144, in get_formkey
response = self.client.get(self.BASE_URL, headers=self.HEADERS, follow_redirects=True)
File "C:\Users\cao\AppData\Roaming\Python\Python39\site-packages\httpx_client.py", line 1041, in get
return self.request(
File "C:\Users\cao\AppData\Roaming\Python\Python39\site-packages\httpx_client.py", line 814, in request
return self.send(request, auth=auth, follow_redirects=follow_redirects)
File "C:\Users\cao\AppData\Roaming\Python\Python39\site-packages\httpx_client.py", line 901, in send
response = self._send_handling_auth(
File "C:\Users\cao\AppData\Roaming\Python\Python39\site-packages\httpx_client.py", line 929, in _send_handling_auth
response = self._send_handling_redirects(
File "C:\Users\cao\AppData\Roaming\Python\Python39\site-packages\httpx_client.py", line 966, in _send_handling_redirects
response = self._send_single_request(request)
File "C:\Users\cao\AppData\Roaming\Python\Python39\site-packages\httpx_client.py", line 1002, in _send_single_request
response = transport.handle_request(request)
File "C:\Users\cao\AppData\Roaming\Python\Python39\site-packages\httpx_transports\default.py", line 218, in handle_request
resp = self._pool.handle_request(req)
File "D:\software\anaconda\lib\contextlib.py", line 137, in exit
self.gen.throw(typ, value, traceback)
File "C:\Users\cao\AppData\Roaming\Python\Python39\site-packages\httpx_transports\default.py", line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: EOF occurred in violation of protocol (_ssl.c:1129)
from poe-api-wrapper.
I lowered the version of urllib3 to 1.25.11 and solved the above problem. It shows that the connection is established but another problem occurs. Have you ever encountered this situation?
from poe-api-wrapper.
I lowered the version of urllib3 to 1.25.11 and solved the above problem. It shows that the connection is established but another problem occurs. Have you ever encountered this situation?
请问你的问题解决了吗
from poe-api-wrapper.
I lowered the version of urllib3 to 1.25.11 and solved the above problem. It shows that the connection is established but another problem occurs. Have you ever encountered this situation?
请问你的问题解决了吗
今天重新装了一遍,还是同样的问题,换换别的库吧,别在一棵树上吊死。
from poe-api-wrapper.
@Hecbi 首先非常感谢您的分享,我今晚尝试后也能正确识别代理,不过仍存在下面这个问题
我分别使用了quora.com 和 poe.com 最新的 token ,也更新了 poe-api-wrapper ,我不太清楚是什么原因导致该问题。如果您曾遇到过相似的问题,方便分享一下您是如何解决的吗?
from poe-api-wrapper.
@Hecbi 首先非常感谢您的分享,我今晚尝试后也能正确识别代理,不过仍存在下面这个问题 我分别使用了quora.com 和 poe.com 最新的 token ,也更新了 poe-api-wrapper ,我不太清楚是什么原因导致该问题。如果您曾遇到过相似的问题,方便分享一下您是如何解决的吗?
找到原因了,def ws_run_thread(self) 中的 "http_proxy_port"这个端口号需要修改成自己的端口。
终于可以愉快的玩耍了,再次感谢!
from poe-api-wrapper.
Related Issues (20)
- I am getting an error when running the following commands. Maybe I'm not installing it correctly. I have Python 3.12.1 HOT 11
- Bot is not available HOT 2
- client.purge_conversation count doesn't work properly
- The poe seems to have updated its interface, and any bot name is currently unavailable. HOT 3
- An error occurred: Bot chinchilla not found. Make sure the bot exists before creating new chat. HOT 2
- Can't get response anymore - API broken? HOT 12
- Can not upload file after update newest code HOT 4
- Cancelling message returns an error HOT 2
- I don't know how to use
- httpcore.ConnectError: [WinError 10054] | Proxy Error HOT 1
- Will there be an Async version of the Library?
- Failed to extract the form key HOT 3
- Add gemini pro in poe-api-wrapper HOT 1
- chat_break not clearing context HOT 2
- Rate limit exceeded for sending requests to poe.com. Please try again later. HOT 7
- Rate limit exceeded for sending requests to poe.com. HOT 9
- No WAY To send a message to a non default bot.
- Is there a way to grab output message citation content ? HOT 4
- get_available_knowledge is limited to the 5 last entries HOT 1
- json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) HOT 6
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.