简体   繁体   English

热图 [Errno 111] pythonanywhere.com 上的连接被拒绝

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

I write a test bot for telegram by Pyrogram library.我通过Pyrogram库为电报编写了一个测试机器人。 It work on my local but on pythonanywhere bash not work and can not connect:它在我的本地工作,但在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

Then when I press ctrl+c to stop app:然后当我按 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

I installed all requirements.我安装了所有要求。 But dose not work at all.但根本不起作用。

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

Error should be quite clear.错误应该很清楚。 The connection is being refused.连接被拒绝。

Pythonanywhere doesn't let you use random ports and does not work with Telegram. Pythonanywhere 不允许您使用随机端口,并且不适用于 Telegram。 Libraries that work via HTTP (Python-Telegram-Bot for example) should work, but Pyrogram does not.通过 HTTP 工作的库(例如 Python-Telegram-Bot)应该可以工作,但 Pyrogram 不行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM