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/stainless-sdks/openint-python/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/openintegrations/python-sdk/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`
23
+
> Once this package is [published to PyPI](https://app.stainless.com/docs/guides/publish), this will become: `pip install --pre openint_sdk`
24
24
25
25
## Usage
26
26
27
27
The full API of this library can be found in [api.md](api.md).
28
28
29
29
```python
30
-
from openint import Openint
30
+
import os
31
+
from openint_sdk import Openint
31
32
32
33
client = Openint(
33
-
api_key="My API Key",
34
+
api_key=os.environ.get("OPENINT_API_KEY"), # This is the default and can be omitted
34
35
)
35
36
36
37
response = client.get_connection()
37
38
print(response.items)
38
39
```
39
40
41
+
While you can provide an `api_key` keyword argument,
42
+
we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
43
+
to add `OPENINT_API_KEY="My API Key"` to your `.env` file
44
+
so that your API Key is not stored in source control.
45
+
40
46
## Async usage
41
47
42
48
Simply import `AsyncOpenint` instead of `Openint` and use `await` with each API call:
43
49
44
50
```python
51
+
import os
45
52
import asyncio
46
-
fromopenintimport AsyncOpenint
53
+
fromopenint_sdkimport AsyncOpenint
47
54
48
55
client = AsyncOpenint(
49
-
api_key="My API Key",
56
+
api_key=os.environ.get("OPENINT_API_KEY"), # This is the default and can be omitted
50
57
)
51
58
52
59
@@ -71,29 +78,27 @@ Typed requests and responses provide autocomplete and documentation within your
71
78
72
79
## Handling errors
73
80
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.
81
+
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.
75
82
76
83
When the API returns a non-success status code (that is, 4xx or 5xx
77
-
response), a subclass of `openint.APIStatusError` is raised, containing `status_code` and `response` properties.
84
+
response), a subclass of `openint_sdk.APIStatusError` is raised, containing `status_code` and `response` properties.
78
85
79
-
All errors inherit from `openint.APIError`.
86
+
All errors inherit from `openint_sdk.APIError`.
80
87
81
88
```python
82
-
importopenint
83
-
fromopenintimport Openint
89
+
importopenint_sdk
90
+
fromopenint_sdkimport Openint
84
91
85
-
client = Openint(
86
-
api_key="My API Key",
87
-
)
92
+
client = Openint()
88
93
89
94
try:
90
95
client.get_connection()
91
-
exceptopenint.APIConnectionError as e:
96
+
exceptopenint_sdk.APIConnectionError as e:
92
97
print("The server could not be reached")
93
98
print(e.__cause__) # an underlying Exception, likely raised within httpx.
94
-
exceptopenint.RateLimitError as e:
99
+
exceptopenint_sdk.RateLimitError as e:
95
100
print("A 429 status code was received; we should back off a bit.")
96
-
exceptopenint.APIStatusError as e:
101
+
exceptopenint_sdk.APIStatusError as e:
97
102
print("Another non-200-range status code was received")
98
103
print(e.status_code)
99
104
print(e.response)
@@ -121,13 +126,12 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
121
126
You can use the `max_retries` option to configure or disable retry settings:
122
127
123
128
```python
124
-
fromopenintimport Openint
129
+
fromopenint_sdkimport Openint
125
130
126
131
# Configure the default for all requests:
127
132
client = Openint(
128
133
# default is 2
129
134
max_retries=0,
130
-
api_key="My API Key",
131
135
)
132
136
133
137
# Or, configure per-request:
@@ -140,19 +144,17 @@ By default requests time out after 1 minute. You can configure this with a `time
140
144
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
client = response.parse() # get the object that `get_connection()` would have returned
206
206
print(client.items)
207
207
```
208
208
209
-
These methods return an [`APIResponse`](https://github.com/stainless-sdks/openint-python/tree/main/src/openint/_response.py) object.
209
+
These methods return an [`APIResponse`](https://github.com/openintegrations/python-sdk/tree/main/src/openint_sdk/_response.py) object.
210
210
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.
211
+
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.
212
212
213
213
#### `.with_streaming_response`
214
214
@@ -270,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.
295
294
296
295
```py
297
-
fromopenintimport Openint
296
+
fromopenint_sdkimport Openint
298
297
299
-
with Openint(
300
-
api_key="My API Key",
301
-
) as client:
298
+
with Openint() as client:
302
299
# make requests here
303
300
...
304
301
@@ -315,7 +312,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
315
312
316
313
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
317
314
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.
315
+
We are keen for your feedback; please open an [issue](https://www.github.com/openintegrations/python-sdk/issues) with questions, bugs, or suggestions.
319
316
320
317
### Determining the installed version
321
318
@@ -324,8 +321,8 @@ If you've upgraded to the latest version but aren't seeing any new features you
324
321
You can determine the version that is being used at runtime with:
0 commit comments