TwitterUserCache
Documentation for eth_defi.feed.twitter_api.TwitterUserCache Python class.
- class TwitterUserCache
Bases:
objectFile-backed cache of Twitter handle-to-user-ID mappings.
Stored at
~/.tradingstrategy/vaults/feeds/twitter-users.json.Methods summary
__init__([path])get(handle)Look up a cached user entry by handle (case-insensitive).
Return a mapping of handle → user_id for all cached entries.
get_by_user_id(user_id)Look up a cached user entry by numeric user ID.
is_stale(handle[, max_age_days])Check whether a cache entry is missing or older than
max_age_days.put(handle, user_id, name)Store or update a cache entry.
save()Persist the cache to disk.
- __init__(path=None)
- Parameters
path (Optional[pathlib.Path]) –
- get(handle)
Look up a cached user entry by handle (case-insensitive).
- Parameters
handle (str) –
- Return type
- get_all_user_ids()
Return a mapping of handle → user_id for all cached entries.
- get_by_user_id(user_id)
Look up a cached user entry by numeric user ID.
- Parameters
user_id (str) –
- Return type
- is_stale(handle, max_age_days=30)
Check whether a cache entry is missing or older than
max_age_days.
- put(handle, user_id, name)
Store or update a cache entry.
- save()
Persist the cache to disk.
- Return type
None