Skip to content

Commit

Permalink
Update code snippets in README (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshalX authored Dec 11, 2023
1 parent 9590ad6 commit 2d1384e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,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()

Expand All @@ -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__':
Expand Down
16 changes: 10 additions & 6 deletions docs/source/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -30,15 +32,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__':
Expand Down

0 comments on commit 2d1384e

Please sign in to comment.