Comments (5)
Normally the CLI should response with a success status, indicating whether it did execute the command, or if it failed.
pytg.exceptions.NoResponse
:
This Exception means the CLI didn't send any response to that command in time.
This occasionally happens with the status_online
command.
Per default the status_online
command waits the default timeout specified in Sender.default_answer_timeout
which is 1.0
seconds. You may change the timeout of any command with supplying result_timeout=<seconds>
in the call.
Also you can surround it with a try
block, excepting a NoResponse
if you like to ignore it.
Combined example:
try:
sender.status_online(result_timeout=5) # wait up to 5 seconds
except NoResponse: # from pytg.exceptions import NoResponse
print("CLI did not responded in time")
Some questions, if this happens not only occasionally:
- How did you start the CLI, manually or with python?
- If started manually, did you start it with the
--json
flag?
from pytg.
added to documentation in commit 22e5b4b
from pytg.
Hi donald,
yes i start the CLI manually with
./telegram-cli -P 6090 -W --json
and i start to learn how to use this package with ping.py, i think the problem was the:
sender.status_online()
so your solutions to add some err handling with:
try:
sender.status_online(result_timeout=5) # wait up to 5 seconds
except NoResponse: # from pytg.exceptions import NoResponse
print("CLI did not responded in time")
its work like a charm
Thx bro
from pytg.
Your welcome.
from pytg.
Honestly I have no Idea why that line fails so often :D
from pytg.
Related Issues (20)
- Error in sending message - Error 38: 'can not parse arg #1' with [disable_preview] HOT 7
- how to get Post ID after sending to channel HOT 1
- Problem With bad Internet HOT 1
- is any command for "delete all from this user" HOT 2
- Reply keyboard HOT 1
- Usage with asyncio HOT 1
- no event for message received in channel HOT 3
- error with fwd_media HOT 1
- NoResponse: [disable_preview] load_document HOT 2
- pytg: INFO CLI did not responde HOT 1
- Telegram.stop_cli() function doesn't work HOT 13
- get rid of DictObject HOT 2
- Using multiple if checks in bot_ping.py results in check failure HOT 1
- ERROR 'RPC_CALL_FAIL 401: AUTH_KEY_UNREGISTERED' HOT 1
- How can I know my telegram-cli account is blocked or not authorized? HOT 2
- sender.history() doesn't work HOT 1
- result_parser.py line 28
- How to keep a CLI already running in json mode on port 4458 ? HOT 2
- Retrieve caption of a sended document? HOT 1
- Result parser for secret chats raises exception due to expected result in JSON HOT 1
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 pytg.