atproto_client.client.methods_mixin

class atproto_client.client.methods_mixin.SessionMethodsMixin(*args: Any, **kwargs: Any)

Bases: TimeMethodsMixin

export_session_string() str

Export session string.

Note

This method is useful for storing the session and reusing it later.

Warning

You should use it if you create the client instance often. Because of server rate limits for createSession. Rate limited by handle. 30/5 min, 300/day.

Attention

You must export session at the end of the Client`s life cycle! Alternatively, you can subscribe to the session change event. Use on_session_change to register handler.

Example

>>> from atproto import Client
>>> # the first time login with login and password
>>> client = Client()
>>> client.login('login', 'password')
>>> session_string = client.export_session_string()
>>> # store session_string somewhere.
>>> # for example, in env and next time use it for login
>>> client2 = Client()
>>> client2.login(session_string=session_string)
Returns:

Session string.

Return type:

str

class atproto_client.client.methods_mixin.TimeMethodsMixin

Bases: object

get_current_time() datetime

Get current time in Server Timezone (UTC).

get_current_time_iso() str

Get current time in Server Timezone (UTC) and ISO format.

get_time_from_timestamp(timestamp: int) datetime

Get datetime from timestamp in Server Timezone (UTC).

Submodules