-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import asyncio | ||
|
||
from stellar_sdk import AiohttpClient, Server | ||
|
||
HORIZON_URL = "https://horizon.stellar.org" | ||
|
||
|
||
async def payments(): | ||
async with Server(HORIZON_URL, AiohttpClient()) as server: | ||
async for payment in server.payments().cursor(cursor="now").stream(): | ||
print(f"Payment: {payment}") | ||
|
||
|
||
async def effects(): | ||
async with Server(HORIZON_URL, AiohttpClient()) as server: | ||
async for effect in server.effects().cursor(cursor="now").stream(): | ||
print(f"Effect: {effect}") | ||
|
||
|
||
async def operations(): | ||
async with Server(HORIZON_URL, AiohttpClient()) as server: | ||
async for operation in server.operations().cursor(cursor="now").stream(): | ||
print(f"Operation: {operation}") | ||
|
||
|
||
async def transactions(): | ||
async with Server(HORIZON_URL, AiohttpClient()) as server: | ||
async for transaction in server.transactions().cursor(cursor="now").stream(): | ||
print(f"Transaction: {transaction}") | ||
|
||
|
||
async def listen(): | ||
await asyncio.gather( | ||
payments(), | ||
effects(), | ||
operations(), | ||
transactions() | ||
) | ||
|
||
|
||
if __name__ == '__main__': | ||
asyncio.run(listen()) |