You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Alternatively, you can build from source and install the wheel file:
@@ -121,7 +121,7 @@ the changes aren't made through the automated pipeline, you may want to make rel
121
121
122
122
### Publish with a GitHub workflow
123
123
124
-
You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/openintegrations/python-sdk/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
124
+
You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/stainless-sdks/openint-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
> Once this package is [published to PyPI](https://app.stainless.com/docs/guides/publish), this will become: `pip install --pre openint`
24
+
22
25
## Usage
23
26
24
27
The full API of this library can be found in [api.md](api.md).
25
28
26
29
```python
27
-
import os
28
-
from openint_sdk import Openint
30
+
from openint import Openint
29
31
30
32
client = Openint(
31
-
bearer_token=os.environ.get("OPENINT_BEARER_TOKEN"), # This is the default and can be omitted
33
+
api_key="My API Key",
32
34
)
33
35
34
-
response= client.retrieve_connection()
35
-
print(response.items)
36
+
connection= client.connection.retrieve()
37
+
print(connection.items)
36
38
```
37
39
38
-
While you can provide a `bearer_token` keyword argument,
39
-
we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
40
-
to add `OPENINT_BEARER_TOKEN="My Bearer Token"` to your `.env` file
41
-
so that your Bearer Token is not stored in source control.
42
-
43
40
## Async usage
44
41
45
42
Simply import `AsyncOpenint` instead of `Openint` and use `await` with each API call:
46
43
47
44
```python
48
-
import os
49
45
import asyncio
50
-
fromopenint_sdkimport AsyncOpenint
46
+
fromopenintimport AsyncOpenint
51
47
52
48
client = AsyncOpenint(
53
-
bearer_token=os.environ.get("OPENINT_BEARER_TOKEN"), # This is the default and can be omitted
49
+
api_key="My API Key",
54
50
)
55
51
56
52
57
53
asyncdefmain() -> None:
58
-
response=await client.retrieve_connection()
59
-
print(response.items)
54
+
connection=await client.connection.retrieve()
55
+
print(connection.items)
60
56
61
57
62
58
asyncio.run(main())
@@ -75,27 +71,29 @@ Typed requests and responses provide autocomplete and documentation within your
75
71
76
72
## Handling errors
77
73
78
-
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `openint_sdk.APIConnectionError` is raised.
74
+
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `openint.APIConnectionError` is raised.
79
75
80
76
When the API returns a non-success status code (that is, 4xx or 5xx
81
-
response), a subclass of `openint_sdk.APIStatusError` is raised, containing `status_code` and `response` properties.
77
+
response), a subclass of `openint.APIStatusError` is raised, containing `status_code` and `response` properties.
82
78
83
-
All errors inherit from `openint_sdk.APIError`.
79
+
All errors inherit from `openint.APIError`.
84
80
85
81
```python
86
-
importopenint_sdk
87
-
fromopenint_sdkimport Openint
82
+
importopenint
83
+
fromopenintimport Openint
88
84
89
-
client = Openint()
85
+
client = Openint(
86
+
api_key="My API Key",
87
+
)
90
88
91
89
try:
92
-
client.retrieve_connection()
93
-
exceptopenint_sdk.APIConnectionError as e:
90
+
client.connection.retrieve()
91
+
exceptopenint.APIConnectionError as e:
94
92
print("The server could not be reached")
95
93
print(e.__cause__) # an underlying Exception, likely raised within httpx.
96
-
exceptopenint_sdk.RateLimitError as e:
94
+
exceptopenint.RateLimitError as e:
97
95
print("A 429 status code was received; we should back off a bit.")
98
-
exceptopenint_sdk.APIStatusError as e:
96
+
exceptopenint.APIStatusError as e:
99
97
print("Another non-200-range status code was received")
100
98
print(e.status_code)
101
99
print(e.response)
@@ -123,16 +121,17 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
123
121
You can use the `max_retries` option to configure or disable retry settings:
client= response.parse() # get the object that `retrieve_connection()` would have returned
203
-
print(client.items)
205
+
connection= response.parse() # get the object that `connection.retrieve()` would have returned
206
+
print(connection.items)
204
207
```
205
208
206
-
These methods return an [`APIResponse`](https://github.com/openintegrations/python-sdk/tree/main/src/openint_sdk/_response.py) object.
209
+
These methods return an [`APIResponse`](https://github.com/stainless-sdks/openint-python/tree/main/src/openint/_response.py) object.
207
210
208
-
The async client returns an [`AsyncAPIResponse`](https://github.com/openintegrations/python-sdk/tree/main/src/openint_sdk/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
211
+
The async client returns an [`AsyncAPIResponse`](https://github.com/stainless-sdks/openint-python/tree/main/src/openint/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
209
212
210
213
#### `.with_streaming_response`
211
214
@@ -214,7 +217,7 @@ The above interface eagerly reads the full response body when you make the reque
214
217
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
215
218
216
219
```python
217
-
with client.with_streaming_response.retrieve_connection() as response:
220
+
with client.connection.with_streaming_response.retrieve() as response:
218
221
print(response.headers.get("X-My-Header"))
219
222
220
223
for line in response.iter_lines():
@@ -267,7 +270,7 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
291
295
292
296
```py
293
-
fromopenint_sdkimport Openint
297
+
fromopenintimport Openint
294
298
295
-
with Openint() as client:
299
+
with Openint(
300
+
api_key="My API Key",
301
+
) as client:
296
302
# make requests here
297
303
...
298
304
@@ -309,7 +315,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
309
315
310
316
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
311
317
312
-
We are keen for your feedback; please open an [issue](https://www.github.com/openintegrations/python-sdk/issues) with questions, bugs, or suggestions.
318
+
We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/openint-python/issues) with questions, bugs, or suggestions.
313
319
314
320
### Determining the installed version
315
321
@@ -318,8 +324,8 @@ If you've upgraded to the latest version but aren't seeing any new features you
318
324
You can determine the version that is being used at runtime with:
0 commit comments