Open vhdmsm opened 8 years ago
Could not reproduce that.
from pytg.sender import Sender
s = Sender("localhost", 4458)
s.dialog_list(10000)
Try starting the cli with at least the --json
flag, does that work?
Yes what i said was with json
flag and it's okay with cli, but pytg raises this exception:
dialog_list = sender.dialog_list(1500)
File "/usr/local/lib/python3.4/site-packages/pytg-0.4.5-py3.4.egg/pytg/sender.py", line 570, in command_alias
File "/usr/local/lib/python3.4/site-packages/pytg-0.4.5-py3.4.egg/pytg/sender.py", line 272, in execute_function
File "/usr/local/lib/python3.4/site-packages/pytg-0.4.5-py3.4.egg/pytg/sender.py", line 381, in _do_command
File "/usr/local/lib/python3.4/site-packages/pytg-0.4.5-py3.4.egg/pytg/sender.py", line 471, in _do_send
pytg.exceptions.NoResponse: [disable_preview] dialog_list 1500
P.S: i've modified pytg for supporting channels by myself.
You wrote dialog_list(1500)
but it just execute that as dialog_list(999)
? Thats strange.
What does the logs print?
# add this to the first lines in your file
import logging
logging.basicConfig(level=logging.DEBUG)
Regarding
P.S: i've modified pytg for supporting channels by myself.
What part of pytg is not supported? Also, do you want to contribute your changes and create a pull request?
You wrote dialog_list(1500) but it just execute that as dialog_list(999)? Thats strange.
I was just testing numbers :D it isn't going to be executed with large input.
What part of pytg is not supported? Also, do you want to contribute your changes and create a pull request?
What i changed before was just changing type
to peer_type
in fix_msg_array.py
file because of channels in tg
that was in test branch which is applied in pytg now(at that time i didn't know that pytg will support test branch too). Anyway i've changed my pytg version to the current version 0.4.9
to see it works or not and nothing has changed and this is the logs:
DEBUG:pytg.sender:Parsing dialog_list: Argument 1210 - [limit] (needed)
DEBUG:pytg.sender:Skipping missing optional parameter #1 [offset] (type NonNegativeNumber) in function dialog_list.
DEBUG:pytg.sender:Sending command >[disable_preview] dialog_list 1210
<
DEBUG:pytg.sender:Socket Connected.
DEBUG:pytg.sender:All Sent.
Traceback (most recent call last):
File "/usr/local/lib/python3.4/site-packages/pytg-0.4.9-py3.4.egg/pytg/sender.py", line 502, in _do_send
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "dumper.py", line 313, in <module>
main()
File "dumper.py", line 309, in main
processor(conn, c, sender)
File "dumper.py", line 54, in processor
dialog_list = sender.dialog_list(1210)
File "/usr/local/lib/python3.4/site-packages/pytg-0.4.9-py3.4.egg/pytg/sender.py", line 628, in command_alias
File "/usr/local/lib/python3.4/site-packages/pytg-0.4.9-py3.4.egg/pytg/sender.py", line 318, in execute_function
File "/usr/local/lib/python3.4/site-packages/pytg-0.4.9-py3.4.egg/pytg/sender.py", line 525, in _do_send
pytg.exceptions.NoResponse: [disable_preview] dialog_list 1210
INFO:pytg.sender:Quit Sending. Not allowing sending anymore.
WARNING:pytg.sender:Terminating currently sending request.
INFO:pytg.sender:Currently not Sending.
Pasting that command into netcat works here...
mac:~ luckydonald$ nc localhost 4458
[disable_preview] dialog_list 1210
ANSWER 12092
[{"members_num": 0, "admin": {"id": "$01000000000000000000000000000000", "peer_type": "
How many groups and channels do u have? mine is like +1000 channels and groups and maybe it took long time to process i don't know.
Have you timed, how long it will take?
Well i think this is about tg
again, i ran it to the tg
directly and it took long time just like now and nothing shows up.
Hm, I would wrap it with a try
except
block then, and retry until you get a result.
Also you can manually set a higher timeout.
Last thing I can think of would be to check if maybe an old instance of the cli is still running in the background.
When i run
dialog_list
command with large number as input argument it return noResponse exception but in telegram-cli it returns all of list. For example:dialog_list 1500
in pytg will return noResponse exception while default_answer_timeout is enough time like 60seconds to get the results. This is an issue with tg? Thanks.