From 2d1384e9187079b7103c03e4f8d2106ab9acbc2d Mon Sep 17 00:00:00 2001 From: Ilya Siamionau Date: Mon, 11 Dec 2023 14:38:30 +0100 Subject: [PATCH] Update code snippets in README (#198) --- README.md | 16 ++++++++++------ docs/source/readme.md | 16 ++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index f9c9d60d..7b59e7db 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ Code snippet: ```python from atproto import Client, models +from atproto.utils import TextBuilder def main(): @@ -32,10 +33,11 @@ def main(): profile = client.login('my-handle', 'my-password') print('Welcome,', profile.display_name) - response = client.send_post(text='Hello World from Python!') - client.like(models.create_strong_ref(response)) + text = TextBuilder().text('Hello World from ').link('Python SDK', 'https://atproto.blue') + post = client.send_post(text) + client.like(models.create_strong_ref(post)) + - if __name__ == '__main__': main() @@ -48,15 +50,17 @@ if __name__ == '__main__': import asyncio from atproto import AsyncClient, models +from atproto.utils import TextBuilder async def main(): client = AsyncClient() profile = await client.login('my-handle', 'my-password') print('Welcome,', profile.display_name) - - response = await client.send_post(text='Hello World from Python!') - await client.like(models.create_strong_ref(response)) + + text = TextBuilder().text('Hello World from ').link('Python SDK', 'https://atproto.blue') + post = await client.send_post(text) + await client.like(models.create_strong_ref(post)) if __name__ == '__main__': diff --git a/docs/source/readme.md b/docs/source/readme.md index 08021337..88344d62 100644 --- a/docs/source/readme.md +++ b/docs/source/readme.md @@ -7,17 +7,19 @@ Code snippet: ```python from atproto import Client, models +from atproto.utils import TextBuilder def main(): client = Client() profile = client.login('my-handle', 'my-password') print('Welcome,', profile.display_name) - - response = client.send_post(text='Hello World from Python!') - client.like(models.create_strong_ref(response)) - + text = TextBuilder().text('Hello World from ').link('Python SDK', 'https://atproto.blue') + post = client.send_post(text) + client.like(models.create_strong_ref(post)) + + if __name__ == '__main__': main() @@ -30,6 +32,7 @@ if __name__ == '__main__': import asyncio from atproto import AsyncClient, models +from atproto.utils import TextBuilder async def main(): @@ -37,8 +40,9 @@ async def main(): profile = await client.login('my-handle', 'my-password') print('Welcome,', profile.display_name) - response = await client.send_post(text='Hello World from Python!') - await client.like(models.create_strong_ref(response)) + text = TextBuilder().text('Hello World from ').link('Python SDK', 'https://atproto.blue') + post = await client.send_post(text) + await client.like(models.create_strong_ref(post)) if __name__ == '__main__':