Skip to content

Commit 3815aad

Browse files
docs(readme): improve example snippets (#31)
1 parent 0b701e1 commit 3815aad

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

README.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ customer = client.customers.create(
3232
3333
name="My Customer",
3434
)
35+
print(customer.id)
3536
```
3637

3738
While you can provide an `api_key` keyword argument,
@@ -44,6 +45,7 @@ so that your API Key is not stored in source control.
4445
Simply import `AsyncOrb` instead of `Orb` and use `await` with each API call:
4546

4647
```python
48+
import asyncio
4749
from orb import AsyncOrb
4850

4951
client = AsyncOrb(
@@ -52,12 +54,12 @@ client = AsyncOrb(
5254
)
5355

5456

55-
async def main():
57+
async def main() -> None:
5658
customer = await client.customers.create(
5759
5860
name="My Customer",
5961
)
60-
print(customer)
62+
print(customer.id)
6163

6264

6365
asyncio.run(main())
@@ -145,7 +147,7 @@ from orb import Orb
145147

146148
client = Orb()
147149

148-
client.customers.create(
150+
customer = client.customers.create(
149151
150152
name="My Customer",
151153
billing_address={
@@ -154,6 +156,7 @@ client.customers.create(
154156
"line1": "123 Example Street",
155157
},
156158
)
159+
print(customer.id)
157160
```
158161

159162
## Handling errors
@@ -287,10 +290,9 @@ from orb import Orb
287290

288291
client = Orb()
289292
response = client.customers.with_raw_response.create(
290-
email="string",
291-
name="string",
293+
294+
name="My Customer",
292295
)
293-
294296
print(response.headers.get('X-My-Header'))
295297

296298
customer = response.parse() # get the object that `customers.create()` would have returned

0 commit comments

Comments
 (0)