MarshalX / atproto

The AT Protocol (🦋 Bluesky) SDK for Python 🐍
https://atproto.blue
MIT License
278 stars 30 forks source link

Add on session change callback #269

Closed MarshalX closed 7 months ago

MarshalX commented 7 months ago

closes #268

Usage example:

from atproto import Client, SessionEvent, Session

client = Client()

@client.on_session_change
def on_session_change(event: SessionEvent, session: Session) -> None:
    print(event, session)

# or without decorator:
# client.on_session_change(on_session_change)

client.login('handle', 'pass')

Async usage example:

from atproto import AsyncClient, SessionEvent, Session

client = AsyncClient()

@client.on_session_change
async def on_session_change(event: SessionEvent, session: Session) -> None:
    print(event, session)

# or without decorator:
# client.on_session_change(on_session_change)

await client.login('handle', 'pass')
MarshalX commented 7 months ago

@grantmcconnaughey any suggestions?

grantmcconnaughey commented 7 months ago

Sorry for the delay! This looks great, and I really appreciate you writing up that documentation. 🙏

MarshalX commented 7 months ago

@grantmcconnaughey This has been released in https://github.com/MarshalX/atproto/releases/tag/v0.0.41

btw as i understand postpone uses atproto SDK? may i mention it in the repo`s readme in a section like "Who uses The AT Protocol SDK for Python"? or maybe you have a page where you mention used open source projects