簡體   English   中英

熱圖 [Errno 111] pythonanywhere.com 上的連接被拒絕

[英]pyrogram [Errno 111] Connection refused on pythonanywhere.com

我通過Pyrogram庫為電報編寫了一個測試機器人。 它在我的本地工作,但在pythonanywhere bash 上不起作用,無法連接:

INFO:pyrogram.crypto.aes:Using TgCrypto
Pyrogram v1.2.9, Copyright (C) 2017-2021 Dan <https://github.com/delivrance>
Licensed under the terms of the GNU Lesser General Public License v3 or later (LGPLv3+)

INFO:pyrogram.connection.connection:Connecting...
WARNING:pyrogram.connection.connection:Unable to connect due to network issues: [Errno 111] Connection refused
INFO:pyrogram.connection.connection:Connecting...
WARNING:pyrogram.connection.connection:Unable to connect due to network issues: [Errno 111] Connection refused
INFO:pyrogram.connection.connection:Connecting...
WARNING:pyrogram.connection.connection:Unable to connect due to network issues: [Errno 111] Connection refused
WARNING:pyrogram.connection.connection:Connection failed! Trying again...
INFO:pyrogram.connection.connection:Disconnected
INFO:pyrogram.session.session:Session stopped
INFO:pyrogram.connection.connection:Connecting...
WARNING:pyrogram.connection.connection:Unable to connect due to network issues: [Errno 111] Connection refused
INFO:pyrogram.connection.connection:Connecting...
WARNING:pyrogram.connection.connection:Unable to connect due to network issues: [Errno 111] Connection refused
INFO:pyrogram.connection.connection:Connecting...
WARNING:pyrogram.connection.connection:Unable to connect due to network issues: [Errno 111] Connection refused

然后當我按 ctrl+c 停止應用程序時:

Traceback (most recent call last):
  File "/home/taregh/bot.py", line 37, in <module>
    client.run()
  File "/home/taregh/.local/lib/python3.9/site-packages/pyrogram/methods/utilities/run.py", line 61, in run
    self.start()
  File "/home/taregh/.local/lib/python3.9/site-packages/pyrogram/sync.py", line 56, in async_to_sync_wrap
    return loop.run_until_complete(coroutine)
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 629, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 596, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1890, in _run_once
    handle._run()
  File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/home/taregh/.local/lib/python3.9/site-packages/pyrogram/methods/utilities/start.py", line 53, in start
    is_authorized = await self.connect()
  File "/home/taregh/.local/lib/python3.9/site-packages/pyrogram/methods/auth/connect.py", line 46, in connect
    await self.session.start()
  File "/home/taregh/.local/lib/python3.9/site-packages/pyrogram/session/session.py", line 127, in start
    await self.connection.connect()
  File "/home/taregh/.local/lib/python3.9/site-packages/pyrogram/connection/connection.py", line 57, in connect
    await self.protocol.connect(self.address)
  File "/home/taregh/.local/lib/python3.9/site-packages/pyrogram/connection/transport/tcp/tcp_abridged_o.py", line 40, in connect
    await super().connect(address)
  File "/home/taregh/.local/lib/python3.9/site-packages/pyrogram/connection/transport/tcp/tcp.py", line 82, in connect
    self.socket.connect(address)
  File "/usr/local/lib/python3.9/site-packages/socks.py", line 47, in wrapper
    return function(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/socks.py", line 780, in connect
    super(socksocket, self).connect((dest_addr, dest_port))
KeyboardInterrupt

我安裝了所有要求。 但根本不起作用。

Unable to connect due to network issues: [Errno 111] Connection refused

錯誤應該很清楚。 連接被拒絕。

Pythonanywhere 不允許您使用隨機端口,並且不適用於 Telegram。 通過 HTTP 工作的庫(例如 Python-Telegram-Bot)應該可以工作,但 Pyrogram 不行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM