Skip to content

Commit 1bc0aa4

Browse files
feat(api): manual updates
1 parent 8018ccc commit 1bc0aa4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+977
-858
lines changed

.github/workflows/create-releases.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/publish-pypi.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/release-doctor.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.release-please-manifest.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 3
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openint%2Fopenint-2ac1afb60b1dbf595e8fc0e3bd4c4d2b5b2554c7db6996fb2d59f02e9c6fe398.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openint%2Fopenint-08093a755f7a62f77018a053c582a4000a949c5307515d0cbb4cbf9a0b02b68e.yml

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $ pip install -r requirements-dev.lock
3737

3838
Most of the SDK is generated code. Modifications to code will be persisted between generations, but may
3939
result in merge conflicts between manual patches and changes from the generator. The generator will never
40-
modify the contents of the `src/openint_sdk/lib/` and `examples/` directories.
40+
modify the contents of the `src/openint/lib/` and `examples/` directories.
4141

4242
## Adding and running examples
4343

@@ -63,7 +63,7 @@ If you’d like to use the repository from source, you can either install from g
6363
To install via git:
6464

6565
```sh
66-
$ pip install git+ssh://git@github.com/openintegrations/python-sdk.git
66+
$ pip install git+ssh://git@github.com/stainless-sdks/openint-python.git
6767
```
6868

6969
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
121121

122122
### Publish with a GitHub workflow
123123

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.
125125

126126
### Publish manually
127127

README.md

Lines changed: 52 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Openint Python API library
22

3-
[![PyPI version](https://img.shields.io/pypi/v/openint_sdk.svg)](https://pypi.org/project/openint_sdk/)
3+
[![PyPI version](https://img.shields.io/pypi/v/openint.svg)](https://pypi.org/project/openint/)
44

55
The Openint Python library provides convenient access to the Openint REST API from any Python 3.8+
66
application. The library includes type definitions for all request params and response fields,
@@ -15,48 +15,44 @@ The REST API documentation can be found on [docs.openint.com](https://docs.openi
1515
## Installation
1616

1717
```sh
18-
# install from PyPI
19-
pip install --pre openint_sdk
18+
# install from this staging repo
19+
pip install git+ssh://git@github.com/stainless-sdks/openint-python.git
2020
```
2121

22+
> [!NOTE]
23+
> Once this package is [published to PyPI](https://app.stainless.com/docs/guides/publish), this will become: `pip install --pre openint`
24+
2225
## Usage
2326

2427
The full API of this library can be found in [api.md](api.md).
2528

2629
```python
27-
import os
28-
from openint_sdk import Openint
30+
from openint import Openint
2931

3032
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",
3234
)
3335

34-
response = client.retrieve_connection()
35-
print(response.items)
36+
connection = client.connection.retrieve()
37+
print(connection.items)
3638
```
3739

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-
4340
## Async usage
4441

4542
Simply import `AsyncOpenint` instead of `Openint` and use `await` with each API call:
4643

4744
```python
48-
import os
4945
import asyncio
50-
from openint_sdk import AsyncOpenint
46+
from openint import AsyncOpenint
5147

5248
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",
5450
)
5551

5652

5753
async def main() -> None:
58-
response = await client.retrieve_connection()
59-
print(response.items)
54+
connection = await client.connection.retrieve()
55+
print(connection.items)
6056

6157

6258
asyncio.run(main())
@@ -75,27 +71,29 @@ Typed requests and responses provide autocomplete and documentation within your
7571

7672
## Handling errors
7773

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.
7975

8076
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.
8278

83-
All errors inherit from `openint_sdk.APIError`.
79+
All errors inherit from `openint.APIError`.
8480

8581
```python
86-
import openint_sdk
87-
from openint_sdk import Openint
82+
import openint
83+
from openint import Openint
8884

89-
client = Openint()
85+
client = Openint(
86+
api_key="My API Key",
87+
)
9088

9189
try:
92-
client.retrieve_connection()
93-
except openint_sdk.APIConnectionError as e:
90+
client.connection.retrieve()
91+
except openint.APIConnectionError as e:
9492
print("The server could not be reached")
9593
print(e.__cause__) # an underlying Exception, likely raised within httpx.
96-
except openint_sdk.RateLimitError as e:
94+
except openint.RateLimitError as e:
9795
print("A 429 status code was received; we should back off a bit.")
98-
except openint_sdk.APIStatusError as e:
96+
except openint.APIStatusError as e:
9997
print("Another non-200-range status code was received")
10098
print(e.status_code)
10199
print(e.response)
@@ -123,16 +121,17 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
123121
You can use the `max_retries` option to configure or disable retry settings:
124122

125123
```python
126-
from openint_sdk import Openint
124+
from openint import Openint
127125

128126
# Configure the default for all requests:
129127
client = Openint(
130128
# default is 2
131129
max_retries=0,
130+
api_key="My API Key",
132131
)
133132

134133
# Or, configure per-request:
135-
client.with_options(max_retries=5).retrieve_connection()
134+
client.with_options(max_retries=5).connection.retrieve()
136135
```
137136

138137
### Timeouts
@@ -141,21 +140,23 @@ By default requests time out after 1 minute. You can configure this with a `time
141140
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
142141

143142
```python
144-
from openint_sdk import Openint
143+
from openint import Openint
145144

146145
# Configure the default for all requests:
147146
client = Openint(
148147
# 20 seconds (default is 1 minute)
149148
timeout=20.0,
149+
api_key="My API Key",
150150
)
151151

152152
# More granular control:
153153
client = Openint(
154154
timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
155+
api_key="My API Key",
155156
)
156157

157158
# Override per-request:
158-
client.with_options(timeout=5.0).retrieve_connection()
159+
client.with_options(timeout=5.0).connection.retrieve()
159160
```
160161

161162
On timeout, an `APITimeoutError` is thrown.
@@ -193,19 +194,21 @@ if response.my_field is None:
193194
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
194195

195196
```py
196-
from openint_sdk import Openint
197+
from openint import Openint
197198

198-
client = Openint()
199-
response = client.with_raw_response.retrieve_connection()
199+
client = Openint(
200+
api_key="My API Key",
201+
)
202+
response = client.connection.with_raw_response.retrieve()
200203
print(response.headers.get('X-My-Header'))
201204

202-
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)
204207
```
205208

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.
207210

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.
209212

210213
#### `.with_streaming_response`
211214

@@ -214,7 +217,7 @@ The above interface eagerly reads the full response body when you make the reque
214217
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.
215218

216219
```python
217-
with client.with_streaming_response.retrieve_connection() as response:
220+
with client.connection.with_streaming_response.retrieve() as response:
218221
print(response.headers.get("X-My-Header"))
219222

220223
for line in response.iter_lines():
@@ -267,7 +270,7 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
267270

268271
```python
269272
import httpx
270-
from openint_sdk import Openint, DefaultHttpxClient
273+
from openint import Openint, DefaultHttpxClient
271274

272275
client = Openint(
273276
# Or use the `OPENINT_BASE_URL` env var
@@ -276,6 +279,7 @@ client = Openint(
276279
proxy="http://my.test.proxy.example.com",
277280
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
278281
),
282+
api_key="My API Key",
279283
)
280284
```
281285

@@ -290,9 +294,11 @@ client.with_options(http_client=DefaultHttpxClient(...))
290294
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.
291295

292296
```py
293-
from openint_sdk import Openint
297+
from openint import Openint
294298

295-
with Openint() as client:
299+
with Openint(
300+
api_key="My API Key",
301+
) as client:
296302
# make requests here
297303
...
298304

@@ -309,7 +315,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
309315

310316
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
311317

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.
313319

314320
### Determining the installed version
315321

@@ -318,8 +324,8 @@ If you've upgraded to the latest version but aren't seeing any new features you
318324
You can determine the version that is being used at runtime with:
319325

320326
```py
321-
import openint_sdk
322-
print(openint_sdk.__version__)
327+
import openint
328+
print(openint.__version__)
323329
```
324330

325331
## Requirements

0 commit comments

Comments
 (0)