Skip to content

Commit 5a2c941

Browse files
stainless-botRobertCraigie
authored andcommitted
docs(readme): use client everywhere for consistency
1 parent 8049e23 commit 5a2c941

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

README.md

+19-19
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ pip install finch-api
2121
```python
2222
from finch import Finch
2323

24-
finch = Finch(
24+
client = Finch(
2525
access_token="my access token",
2626
)
2727

28-
candidate = finch.ats.candidates.retrieve(
28+
candidate = client.ats.candidates.retrieve(
2929
"<candidate id>",
3030
)
3131
print(candidate.first_name)
@@ -38,13 +38,13 @@ Simply import `AsyncFinch` instead of `Finch` and use `await` with each API call
3838
```python
3939
from finch import AsyncFinch
4040

41-
finch = AsyncFinch(
41+
client = AsyncFinch(
4242
access_token="my access token",
4343
)
4444

4545

4646
async def main():
47-
candidate = await finch.ats.candidates.retrieve(
47+
candidate = await client.ats.candidates.retrieve(
4848
"<candidate id>",
4949
)
5050
print(candidate.first_name)
@@ -70,11 +70,11 @@ This library provides auto-paginating iterators with each list response, so you
7070
```python
7171
import finch
7272

73-
finch = Finch()
73+
client = Finch()
7474

7575
all_jobs = []
7676
# Automatically fetches more pages as needed.
77-
for job in finch.ats.jobs.list():
77+
for job in client.ats.jobs.list():
7878
# Do something with job here
7979
all_jobs.append(job)
8080
print(all_jobs)
@@ -86,13 +86,13 @@ Or, asynchronously:
8686
import asyncio
8787
import finch
8888

89-
finch = AsyncFinch()
89+
client = AsyncFinch()
9090

9191

9292
async def main() -> None:
9393
all_jobs = []
9494
# Iterate through items across all pages, issuing requests as needed.
95-
async for job in finch.ats.jobs.list():
95+
async for job in client.ats.jobs.list():
9696
all_jobs.append(job)
9797
print(all_jobs)
9898

@@ -103,7 +103,7 @@ asyncio.run(main())
103103
Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:
104104

105105
```python
106-
first_page = await finch.ats.jobs.list()
106+
first_page = await client.ats.jobs.list()
107107
if first_page.has_next_page():
108108
print(f"will fetch next page using these details: {first_page.next_page_info()}")
109109
next_page = await first_page.get_next_page()
@@ -115,7 +115,7 @@ if first_page.has_next_page():
115115
Or just work directly with the returned data:
116116

117117
```python
118-
first_page = await finch.ats.jobs.list()
118+
first_page = await client.ats.jobs.list()
119119

120120
print(
121121
f"the current start offset for this page: {first_page.paging.offset}"
@@ -133,9 +133,9 @@ Nested parameters are dictionaries, typed using `TypedDict`, for example:
133133
```python
134134
from finch import Finch
135135

136-
finch = Finch()
136+
client = Finch()
137137

138-
finch.hris.directory.list_individuals(
138+
client.hris.directory.list_individuals(
139139
path_params=[],
140140
params={},
141141
)
@@ -194,13 +194,13 @@ You can use the `max_retries` option to configure or disable this:
194194
from finch import Finch
195195

196196
# Configure the default for all requests:
197-
finch = Finch(
197+
client = Finch(
198198
# default is 2
199199
max_retries=0,
200200
)
201201

202202
# Or, configure per-request:
203-
finch.with_options(max_retries=5).hris.directory.list_individuals()
203+
client.with_options(max_retries=5).hris.directory.list_individuals()
204204
```
205205

206206
### Timeouts
@@ -212,18 +212,18 @@ which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advan
212212
from finch import Finch
213213

214214
# Configure the default for all requests:
215-
finch = Finch(
215+
client = Finch(
216216
# default is 60s
217217
timeout=20.0,
218218
)
219219

220220
# More granular control:
221-
finch = Finch(
221+
client = Finch(
222222
timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
223223
)
224224

225225
# Override per-request:
226-
finch.with_options(timeout=5 * 1000).hris.directory.list_individuals()
226+
client.with_options(timeout=5 * 1000).hris.directory.list_individuals()
227227
```
228228

229229
On timeout, an `APITimeoutError` is thrown.
@@ -241,7 +241,7 @@ Be aware that doing so may result in incorrect types and other unexpected or und
241241
```python
242242
from finch import Finch
243243

244-
finch = Finch(
244+
client = Finch(
245245
default_headers={"Finch-API-Version": "My-Custom-Value"},
246246
)
247247
```
@@ -254,7 +254,7 @@ You can configure the following keyword arguments when instantiating the client:
254254
import httpx
255255
from finch import Finch
256256

257-
finch = Finch(
257+
client = Finch(
258258
# Use a custom base URL
259259
base_url="http://my.test.server.example.com:8083",
260260
proxies="http://my.test.proxy.example.com",

0 commit comments

Comments
 (0)