Lonami Exo
16122545ec
Add check for asyncio event loop to remain the same
2023-05-24 19:15:46 +02:00
Lonami Exo
d7bd554ba0
Fix ValueError during connect with catchup on bad cache
...
Closes #4080 .
2023-04-29 13:10:00 +02:00
Lonami Exo
a657ae0134
Save self user ID in session file
...
Should result in one less request after connecting,
as there is no longer a need to fetch the self user.
2023-04-06 14:18:42 +02:00
Lonami Exo
88bc6a46a6
Store self user in entity cache
2023-04-06 13:58:26 +02:00
Lonami Exo
97b0ba6707
Flush in-memory cache to session after a limit is reached
...
Should fully close #3989 .
Should help with #3235 .
2023-04-06 13:45:12 +02:00
Lonami Exo
d1e3237c41
Remove now-unused EntityCache class
2023-04-06 13:37:40 +02:00
Lonami Exo
f7e38ee6f0
Remove redundant entity cache
...
Progress towards #3989 .
May also help with #3235 .
2023-04-06 13:25:48 +02:00
Kacnep89
68ea208b43
Periodically save update state ( #4071 )
2023-03-28 19:00:36 +02:00
Lonami Exo
cc3d25eeb8
Wrap init request in invokeWithoutUpdates if requested
...
This may fix #3743 .
2023-01-14 13:31:32 +01:00
Lonami Exo
83bafa25e3
Stop using asyncio.get_event_loop()
...
It is deprecated in newer Python versions.
Closes #4013 .
2023-01-11 21:02:29 +01:00
Lonami Exo
c72c7b160a
Introduce trace-level logs to MessageBox
...
These will log sensitive information.
They are disabled when running with PYTHONOPTIMIZED.
They can only be enabled by setting a level lower than DEBUG,
which is difficult to do on accident.
2022-12-17 23:13:06 +01:00
Lonami Exo
4a6ef97910
Fix calls to disconnect after logout
...
Introduced by 83f13da420
.
2022-12-13 08:33:13 +01:00
Lonami Exo
83f13da420
Don't error when calling disconnect after logout
2022-11-27 11:22:30 +01:00
Lonami Exo
04cf2953f6
Document that disconnect cancels event handlers
...
Closes #3942 .
2022-10-03 10:25:15 +02:00
Lonami Exo
ad2238e788
Shield disconnect from cancellation
...
Relevant issue: #3942 .
2022-10-03 10:25:15 +02:00
Lonami Exo
bb98f4e68c
Fix get_dialogs was not filling channels pts
2022-09-27 11:31:41 +02:00
Lonami Exo
49bdb762c9
Re-raise unhandled errors that occur during update handling
...
This should help the situation in #3870 .
2022-09-21 12:13:21 +02:00
Lonami Exo
48d7dbe90b
Remove missed async keywords from the revert
...
This should've been in 7d21b40401
.
This completes the revert of async sessions.
2022-08-30 12:40:05 +02:00
Lonami Exo
7d21b40401
Revert "Make sessions async"
...
This reverts commit d2de0f3aca
.
2022-08-30 12:32:21 +02:00
Lonami Exo
44e3651adf
Revert "Add workaround for SQLiteSession needing save after init"
...
This reverts commit 8190a92aae
.
2022-08-30 12:20:20 +02:00
Lonami Exo
8190a92aae
Add workaround for SQLiteSession needing save after init
2022-05-30 12:59:04 +02:00
Lonami Exo
dfc6d448ed
Expose catch_up in client constructor and default it to False
2022-05-20 14:55:47 +02:00
Lonami Exo
09b9cd8193
Fix initial session state load
2022-05-16 19:01:05 +02:00
Lonami Exo
898eb5b82f
Call GetState on login to init MessageBox
2022-05-16 10:05:07 +02:00
Lonami Exo
3c7f53802f
Fix saving of update state
2022-05-16 09:36:57 +02:00
Lonami Exo
a5c3df2743
Attempt to load and save MessageBox state
2022-05-13 17:40:03 +02:00
Lonami Exo
db09a92bc5
Make use of the new MessageBox
2022-05-13 13:17:16 +02:00
Lonami Exo
b5bfe5d9a1
Remove StateCache
2022-05-13 12:43:50 +02:00
Tulir Asokan
d2de0f3aca
Make sessions async
...
SQLiteSession is not updated, don't try to use it
2022-05-12 10:36:10 +02:00
Lonami Exo
2cb6cd5dad
Change the way no_updates mode is enabled
...
See discussion on https://github.com/LonamiWebs/Telethon/commit/49713b2 .
The problem with the automatic approach is that some scripts may do
some "fancier" things with the way they register updates, so it was
prone to failure (a handler could be added but since the last request
was without updates, nothing would be received).
This new approach is a bit more annoying to opt-into but also more
explicit.
2021-08-29 12:14:03 +02:00
penn5
e546ae2f85
Allow per-request flood sleep threshold selection ( #3123 )
2021-08-06 08:13:34 +02:00
Lonami Exo
3f185aada2
Ignore IPv6 setting if there's no matching DC
...
May close #3075 (assuming this is what was happening).
It's better to return some DC rather than crashing.
2021-06-19 18:32:23 +02:00
Lonami Exo
63f24d2282
Add new known RPC errors and update docs
2021-05-30 18:00:27 +02:00
Lonami Exo
0997e3fa9f
Remove _log_exc workaround and NullHandler
...
It was added back in bfc408b
probably due to a misunderstanding of
https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library .
The default behaviour of logging WARNING and above is good and
desirable (hiding unhandled exceptions in update handlers by default
was a big, accidental mistake). NullHandler is used to *prevent*
this good default, so it shouldn't be used in the first place.
2021-02-02 20:47:02 +01:00
Lonami Exo
de7cf03ba7
Stop storing asyncio loop in TelegramClient
...
The loop parameter was ignored because it shouldn't be used, but
the fact it still stored the current loop on creation messes up
with asyncio.run.
2021-01-18 22:59:19 +01:00
Lonami Exo
1cd11391c4
Unconditionally disconnect exported senders on user disconnect
...
Borrowed senders are not disconnected immediately, but after a while.
If a borrow was used recently but the user requested the main client
to disconnect, those borrows "shouldn't" disconnect because they were
used recently. However, if the user requests a disconnect, they mean
that EVERYTHING should be disconnected, even if the borrows are recent.
This actually gets rid of warnings about send/recv tasks being destroyed,
which partially addresses #1634 . That issue may still have more causes
though.
2020-12-11 16:30:12 +01:00
vegeta1k95
ab3c5acf9a
Add client.set_proxy() ( #1632 )
2020-11-14 14:01:59 +01:00
Serhii Dylda
633986cfa6
Replace PySocks with python-socks for Python >= 3.6
...
See discussion at (https://github.com/LonamiWebs/Telethon/pull/1623 )
Small fixes for `local_addr` argument.
2020-11-09 19:59:54 +01:00
Stefan
d2756cf68f
Add support for local_ip address binding ( #1587 )
2020-10-07 10:03:19 +02:00
Tulir Asokan
8ce7e776c1
Add option to raise last error instead of generic ValueError ( #1571 )
2020-10-01 12:23:10 +02:00
Tanya Degurechaff
1afb5b95e3
Update init params to match those of tdesktop ( #1549 )
2020-09-10 14:52:25 +02:00
conetra
958698bba7
Remove square bracket around IPv6 addresses ( #1517 )
2020-08-08 13:16:01 +02:00
Lonami Exo
1c3e7dda01
Avoid explicitly passing the loop to asyncio
...
This behaviour is deprecated and will be removed in future versions
of Python. Technically, it could be considered a bug (invalid usage
causing different behaviour from the expected one), and in practice
it should not break much code (because .get_event_loop() would likely
be the same event loop anyway).
2020-07-25 18:39:35 +02:00
Lonami Exo
ab594ed0cb
Remove unused imports and variables
2020-07-04 13:29:43 +02:00
KnorpelSenf
0f8119c400
Fix typo in docs ( #1493 )
2020-06-24 14:30:41 +02:00
Lonami Exo
4b933069f1
Add hacks to properly handle events.Album from other DCs
...
Fixes #1479 .
2020-06-06 21:01:02 +02:00
Lonami Exo
d0f937bcb6
Don't disconnect borrowed senders immediately ( #1364 )
2020-04-05 12:34:33 +02:00
Lonami
ac8009af4a
Fix default DC ID value
2020-02-02 10:01:15 +01:00
NotAFile
9121478a2e
fix first type found by tests :)
2019-12-08 00:30:25 +01:00
Lonami Exo
b8aa639f3c
Check for event loop method, not type ( #1337 )
2019-12-06 10:23:15 +01:00