@@ -21,11 +21,11 @@ pip install finch-api
21
21
``` python
22
22
from finch import Finch
23
23
24
- finch = Finch(
24
+ client = Finch(
25
25
access_token = " my access token" ,
26
26
)
27
27
28
- candidate = finch .ats.candidates.retrieve(
28
+ candidate = client .ats.candidates.retrieve(
29
29
" <candidate id>" ,
30
30
)
31
31
print (candidate.first_name)
@@ -38,13 +38,13 @@ Simply import `AsyncFinch` instead of `Finch` and use `await` with each API call
38
38
``` python
39
39
from finch import AsyncFinch
40
40
41
- finch = AsyncFinch(
41
+ client = AsyncFinch(
42
42
access_token = " my access token" ,
43
43
)
44
44
45
45
46
46
async def main ():
47
- candidate = await finch .ats.candidates.retrieve(
47
+ candidate = await client .ats.candidates.retrieve(
48
48
" <candidate id>" ,
49
49
)
50
50
print (candidate.first_name)
@@ -70,11 +70,11 @@ This library provides auto-paginating iterators with each list response, so you
70
70
``` python
71
71
import finch
72
72
73
- finch = Finch()
73
+ client = Finch()
74
74
75
75
all_jobs = []
76
76
# Automatically fetches more pages as needed.
77
- for job in finch .ats.jobs.list():
77
+ for job in client .ats.jobs.list():
78
78
# Do something with job here
79
79
all_jobs.append(job)
80
80
print (all_jobs)
@@ -86,13 +86,13 @@ Or, asynchronously:
86
86
import asyncio
87
87
import finch
88
88
89
- finch = AsyncFinch()
89
+ client = AsyncFinch()
90
90
91
91
92
92
async def main () -> None :
93
93
all_jobs = []
94
94
# 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():
96
96
all_jobs.append(job)
97
97
print (all_jobs)
98
98
@@ -103,7 +103,7 @@ asyncio.run(main())
103
103
Alternatively, you can use the ` .has_next_page() ` , ` .next_page_info() ` , or ` .get_next_page() ` methods for more granular control working with pages:
104
104
105
105
``` python
106
- first_page = await finch .ats.jobs.list()
106
+ first_page = await client .ats.jobs.list()
107
107
if first_page.has_next_page():
108
108
print (f " will fetch next page using these details: { first_page.next_page_info()} " )
109
109
next_page = await first_page.get_next_page()
@@ -115,7 +115,7 @@ if first_page.has_next_page():
115
115
Or just work directly with the returned data:
116
116
117
117
``` python
118
- first_page = await finch .ats.jobs.list()
118
+ first_page = await client .ats.jobs.list()
119
119
120
120
print (
121
121
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:
133
133
``` python
134
134
from finch import Finch
135
135
136
- finch = Finch()
136
+ client = Finch()
137
137
138
- finch .hris.directory.list_individuals(
138
+ client .hris.directory.list_individuals(
139
139
path_params = [],
140
140
params = {},
141
141
)
@@ -194,13 +194,13 @@ You can use the `max_retries` option to configure or disable this:
194
194
from finch import Finch
195
195
196
196
# Configure the default for all requests:
197
- finch = Finch(
197
+ client = Finch(
198
198
# default is 2
199
199
max_retries = 0 ,
200
200
)
201
201
202
202
# 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()
204
204
```
205
205
206
206
### Timeouts
@@ -212,18 +212,18 @@ which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advan
212
212
from finch import Finch
213
213
214
214
# Configure the default for all requests:
215
- finch = Finch(
215
+ client = Finch(
216
216
# default is 60s
217
217
timeout = 20.0 ,
218
218
)
219
219
220
220
# More granular control:
221
- finch = Finch(
221
+ client = Finch(
222
222
timeout = httpx.Timeout(60.0 , read = 5.0 , write = 10.0 , connect = 2.0 ),
223
223
)
224
224
225
225
# 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()
227
227
```
228
228
229
229
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
241
241
``` python
242
242
from finch import Finch
243
243
244
- finch = Finch(
244
+ client = Finch(
245
245
default_headers = {" Finch-API-Version" : " My-Custom-Value" },
246
246
)
247
247
```
@@ -254,7 +254,7 @@ You can configure the following keyword arguments when instantiating the client:
254
254
import httpx
255
255
from finch import Finch
256
256
257
- finch = Finch(
257
+ client = Finch(
258
258
# Use a custom base URL
259
259
base_url = " http://my.test.server.example.com:8083" ,
260
260
proxies = " http://my.test.proxy.example.com" ,
0 commit comments