Async Python Jetstream Client pypi.org/project/atproto_jetstream/
atproto jetstream python zstd
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

improve README.md

+43 -24
+25 -2
README.md
··· 1 - # atproto-jetstream 1 + # atproto_jetstream 2 + 3 + Small, typed, and async package to receive [Jetstream][jetstream] events from the [AT Protocol][atproto]. 4 + 5 + ## usage 6 + 7 + ```python 8 + from asyncio import run 9 + from atproto_jetstream import Jetstream 10 + 11 + 12 + async def main(): 13 + async with Jetstream("jetstream1.us-east.bsky.network") as stream: 14 + async for message in stream: 15 + match message.kind: 16 + case "account": 17 + print(message.account) 18 + case "identity": 19 + print(message.identity) 20 + case "commit": 21 + print(message.commit) 22 + 2 23 3 - Small package to receive [Jetstream][jetstream] events from the [AT Protocol][atproto]. 24 + if __name__ == "__main__": 25 + run(main()) 26 + ``` 4 27 5 28 [atproto]: https://atproto.com/ 6 29 [jetstream]: https://docs.bsky.app/blog/jetstream
+18
example.py
··· 1 + from asyncio import run 2 + from atproto_jetstream import Jetstream 3 + 4 + 5 + async def main(): 6 + async with Jetstream("jetstream1.us-east.bsky.network") as stream: 7 + async for message in stream: 8 + match message.kind: 9 + case "account": 10 + print(message.account) 11 + case "identity": 12 + print(message.identity) 13 + case "commit": 14 + print(message.commit) 15 + 16 + 17 + if __name__ == "__main__": 18 + run(main())
-22
main.py
··· 1 - import asyncio 2 - from atproto_jetstream import Jetstream 3 - 4 - 5 - async def main(): 6 - try: 7 - async with Jetstream("jetstream1.us-east.bsky.network") as stream: 8 - async for message in stream: 9 - match message.kind: 10 - case "account": 11 - print(message.account.did) 12 - case "identity": 13 - print(message.identity.handle) 14 - case "commit": 15 - print(message.commit) 16 - 17 - except asyncio.CancelledError: 18 - pass 19 - 20 - 21 - if __name__ == "__main__": 22 - asyncio.run(main())