2
2
3
3
[ ![ fern shield] ( https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen )] ( https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Ftruefoundry%2Ftruefoundry-python-sdk )
4
4
[ ![ pypi] ( https://img.shields.io/pypi/v/truefoundry-sdk )] ( https://pypi.python.org/pypi/truefoundry-sdk )
5
- [ ![ Ask DeepWiki] ( https://deepwiki.com/badge.svg )] ( https://deepwiki.com/truefoundry/truefoundry-python-sdk )
6
5
7
6
The Truefoundry Python library provides convenient access to the Truefoundry API from Python.
8
7
@@ -23,7 +22,12 @@ Instantiate and use the client with the following:
23
22
``` python
24
23
from truefoundry_sdk import TrueFoundry
25
24
client = TrueFoundry(api_key = " YOUR_API_KEY" , base_url = " https://yourhost.com/path/to/api" , )
26
- client.users.invite_user(accept_invite_client_url = ' <control plane url>/invite-accept' , email = ' email' , )
25
+ response = client.applications.list(limit = 10 , offset = 0 , )
26
+ for item in response:
27
+ yield item
28
+ # alternatively, you can paginate page-by-page
29
+ for page in response.iter_pages():
30
+ yield page
27
31
```
28
32
29
33
## Async Client
@@ -35,7 +39,13 @@ from truefoundry_sdk import AsyncTrueFoundry
35
39
import asyncio
36
40
client = AsyncTrueFoundry(api_key = " YOUR_API_KEY" , base_url = " https://yourhost.com/path/to/api" , )
37
41
async def main () -> None :
38
- await client.users.invite_user(accept_invite_client_url = ' <control plane url>/invite-accept' , email = ' email' , )
42
+ response = await client.applications.list(limit = 10 , offset = 0 , )
43
+ async for item in response:
44
+ yield item
45
+
46
+ # alternatively, you can paginate page-by-page
47
+ async for page in response.iter_pages():
48
+ yield page
39
49
asyncio.run(main())
40
50
```
41
51
@@ -47,7 +57,7 @@ will be thrown.
47
57
``` python
48
58
from truefoundry_sdk.core.api_error import ApiError
49
59
try :
50
- client.users.invite_user (... )
60
+ client.applications.list (... )
51
61
except ApiError as e:
52
62
print (e.status_code)
53
63
print (e.body)
@@ -78,7 +88,7 @@ The `.with_raw_response` property returns a "raw" client that can be used to acc
78
88
``` python
79
89
from truefoundry_sdk import TrueFoundry
80
90
client = TrueFoundry(... , )
81
- response = client.users .with_raw_response.invite_user (... )
91
+ response = client.applications .with_raw_response.list (... )
82
92
print (response.headers) # access the response headers
83
93
print (response.data) # access the underlying object
84
94
pager = client.users.list(... )
@@ -106,7 +116,7 @@ A request is deemed retryable when any of the following HTTP status codes is ret
106
116
Use the ` max_retries ` request option to configure this behavior.
107
117
108
118
``` python
109
- client.users.invite_user (... , request_options = {
119
+ client.applications.list (... , request_options = {
110
120
" max_retries" : 1
111
121
})
112
122
```
@@ -121,7 +131,7 @@ from truefoundry_sdk import TrueFoundry
121
131
client = TrueFoundry(... , timeout = 20.0 , )
122
132
123
133
# Override timeout for a specific method
124
- client.users.invite_user (... , request_options = {
134
+ client.applications.list (... , request_options = {
125
135
" timeout_in_seconds" : 1
126
136
})
127
137
```
0 commit comments