Commit Graph

79 Commits

Author SHA1 Message Date
Kacnep89
e617b59d48
Return marked ID from MemorySession.get_entity_rows_by_id (#4177)
Otherwise the unpacking done later won't work.
2023-08-23 16:07:32 +02:00
R.T
9c7ac3b210
Fix absolute import should be relative (#4101) 2023-04-30 18:27:09 +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
e87e6738b5 Revert "Add missing async keywords in SQLiteSession"
This reverts commit 0f5eeb29e7.
2022-08-30 12:32:23 +02:00
Lonami Exo
7d21b40401 Revert "Make sessions async"
This reverts commit d2de0f3aca.
2022-08-30 12:32:21 +02:00
Lonami Exo
88b2b9372d Revert "Mark certain SQLiteSession methods as async"
This reverts commit f913ea6b75.
2022-08-30 12:22:05 +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
0f5eeb29e7 Add missing async keywords in SQLiteSession 2022-05-30 13:39:08 +02:00
Lonami Exo
8190a92aae Add workaround for SQLiteSession needing save after init 2022-05-30 12:59:04 +02:00
Lonami Exo
80685191ab Add a hack to enable StringSession.save be (a)sync 2022-05-18 14:53:04 +02:00
Lonami Exo
09b9cd8193 Fix initial session state load 2022-05-16 19:01:05 +02:00
Lonami Exo
0dff21a80f Add missing async in sqlite 2022-05-16 09:36:41 +02:00
Lonami Exo
a5c3df2743 Attempt to load and save MessageBox state 2022-05-13 17:40:03 +02:00
Lonami Exo
f913ea6b75 Mark certain SQLiteSession methods as async
Follow-up to d2de0f3aca.
2022-05-12 11:08:18 +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
painor
828cf2dcad
Include "chat" attribute in processing entities (#3133)
Requests like checkChatInvite return a chatInviteAlready, which has
a "chat" attribute similar to the "user" attribute other requests have.
2021-08-29 11:50:48 +02:00
Lonami Exo
67b87a0ea0 Evict old cached usernames in case of collision 2020-10-01 13:20:29 +02:00
Lonami Exo
9c06f29aaf Don't cache entities with min flag set, bump v1.10.2
Since layer 102, there are two access_hash. One with the min flag,
and one without it. This was causing channel invalid errors.

access_hash with min flag set can only be used to fetch files such
as profile pictures.

access_hash with min flag unset can be used under all circumstances.

Previously, the library did not distinguish between these, so it was
caching the hash that could hardly be used for anything.

With this change, only the "full" access_hash is stored, which will
work for any methods.

See also: https://core.telegram.org/api/min
2019-09-12 19:19:46 +02:00
Lonami Exo
8e36bb4c4d Link Python keywords with Python's documentation 2019-07-06 12:11:00 +02:00
Lonami Exo
744f5f50fe Fix saving of StringSession 2019-05-06 08:55:24 +02:00
Lonami Exo
1e17ef1c98 Apply several lints 2019-05-03 21:38:41 +02:00
Lonami
52be689926
Only upgrade database if version < current
Should deal more gracefully when using new
session files in older versions of the library.
2019-05-02 23:20:39 +02:00
Lonami Exo
4d35e8c80f Create a new in-memory cache for entities (#1141) 2019-03-26 11:27:52 +01:00
Lonami Exo
70b08c4952 Get rid of broken JSON migration support (#1113) 2019-02-24 20:16:53 +01:00
Lonami Exo
47d9de98ed Raise ImportError and not ValueError when sqlite3 is missing
Excepting ValueError when creating the SQLiteSession could hide
other errors (e.g. using a newer session file on an older version
of the library). Instead, the original error is raised, as if
sqlite3 was being imported within its __init__ method.
2019-02-13 08:52:54 +01:00
Dmitry D. Chernov
9a98d41a2c Improve TakeoutClient proxy and takeout functionality (#1106) 2019-02-10 11:10:41 +01:00
Lonami Exo
b66c1e6084 Revert "Get rid of now broken cache"
This reverts commit f73ae42a03.
2018-12-25 16:50:11 +01:00
Lonami Exo
f73ae42a03 Get rid of now broken cache 2018-12-25 11:44:10 +01:00
Lonami Exo
0f7c2b891a Fix get entity by exact name since 2ca8ddb 2018-11-15 17:23:47 +01:00
K900
20a8081e8e Fix file cache when using MemorySession (#1033) 2018-11-01 10:29:23 +01:00
Lonami Exo
3c92f6a791 Fix sqlite's conn may be None if never used
This happened when signing up with the library
and getting migrate errors.
2018-09-04 11:28:01 +02:00
Lonami Exo
52a4327769 Fix MemorySession file caching 2018-08-22 16:21:22 +02:00
Lonami Exo
8e62f797bb Support custom encoding for StringSession 2018-08-22 16:12:27 +02:00
Lonami Exo
8ce001318e Fix StringSession(None) 2018-08-05 19:45:56 +02:00
Lonami Exo
0011f19f8b Create a StringSession 2018-08-05 16:24:34 +02:00
Lonami Exo
f4ea662fdd Fix sign in not saving self user to session file 2018-08-02 19:40:48 +02:00
Lonami Exo
7a7923b317 Fallback to MemorySession if sqlite3 is not available 2018-08-02 15:17:44 +02:00
Lonami Exo
2ca8ddbfb4 Use cache for invite links 2018-08-02 13:47:35 +02:00
Lonami Exo
a9cc35e604 Avoid triggering FileMigrateError when possible 2018-07-21 11:59:44 +02:00
Lonami Exo
dc3d281274 Load update state date with explicit timezone (#808) 2018-07-14 00:01:45 +02:00
Lonami Exo
dd0eb7a90e Explicitly open files as 'r' instead of leaving it out 2018-06-29 11:34:57 +02:00
Lonami Exo
9159e2a720 Remove report_errors/flood_sleep_threshold from the session 2018-06-26 16:09:16 +02:00
Lonami Exo
551b0044ce Reuse more code using sqlite's cursor 2018-06-25 20:11:48 +02:00
Lonami Exo
313bead615 Close sqlite's cursor after usage 2018-06-25 19:49:33 +02:00
Lonami Exo
d4479a0a4e Save the session file less often 2018-06-24 12:21:58 +02:00
Lonami Exo
1247d050ab Remove unused fields from the Sessions
Most of the stuff didn't actually need to be saved and only
belong to the MTProtoState which is not a separate class from
the sessions.
2018-06-14 17:04:15 +02:00
Lonami Exo
208adc93a6 Stop using without rowid altogether
While something nice to have if supported, it just causes problems
for people trying to use the same session accross systems having
different sqlite versions. See https://t.me/TelethonChat/36771.
2018-05-14 17:41:47 +02:00
Lonami Exo
b71511cd63 Fix saving update state in the SqliteSession 2018-04-27 21:11:13 +02:00
Lonami Exo
2a00bcaa12 Persist updates.State upon disconnection 2018-04-25 13:37:29 +02:00
Lonami Exo
ea404c5477 Add update_state table to persist pts and such 2018-04-23 21:16:09 +02:00