Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ client = Openint(
api_key=os.environ.get("OPENINT_API_KEY"), # This is the default and can be omitted
)

response = client.get_connection()
print(response.items)
page = client.list_connections()
print(page.items)
```

While you can provide an `api_key` keyword argument,
Expand All @@ -55,8 +55,8 @@ client = AsyncOpenint(


async def main() -> None:
response = await client.get_connection()
print(response.items)
page = await client.list_connections()
print(page.items)


asyncio.run(main())
Expand Down Expand Up @@ -89,7 +89,7 @@ from openint import Openint
client = Openint()

try:
client.get_connection()
client.list_connections()
except openint.APIConnectionError as e:
print("The server could not be reached")
print(e.__cause__) # an underlying Exception, likely raised within httpx.
Expand Down Expand Up @@ -132,7 +132,7 @@ client = Openint(
)

# Or, configure per-request:
client.with_options(max_retries=5).get_connection()
client.with_options(max_retries=5).list_connections()
```

### Timeouts
Expand All @@ -155,7 +155,7 @@ client = Openint(
)

# Override per-request:
client.with_options(timeout=5.0).get_connection()
client.with_options(timeout=5.0).list_connections()
```

On timeout, an `APITimeoutError` is thrown.
Expand Down Expand Up @@ -196,11 +196,11 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
from openint import Openint

client = Openint()
response = client.with_raw_response.get_connection()
response = client.with_raw_response.list_connections()
print(response.headers.get('X-My-Header'))

client = response.parse() # get the object that `get_connection()` would have returned
print(client.items)
client = response.parse() # get the object that `list_connections()` would have returned
print(client)
```

These methods return an [`APIResponse`](https://github.com/openintegrations/python-sdk/tree/main/src/openint/_response.py) object.
Expand All @@ -214,7 +214,7 @@ The above interface eagerly reads the full response body when you make the reque
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.

```python
with client.with_streaming_response.get_connection() as response:
with client.with_streaming_response.list_connections() as response:
print(response.headers.get("X-My-Header"))

for line in response.iter_lines():
Expand Down
4 changes: 2 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Methods:
- <code title="post /connection/{id}/check">client.<a href="./src/openint/_client.py">check_connection</a>(id) -> <a href="./src/openint/types/check_connection_response.py">CheckConnectionResponse</a></code>
- <code title="post /connect/magic-link">client.<a href="./src/openint/_client.py">create_magic_link</a>(\*\*<a href="src/openint/types/client_create_magic_link_params.py">params</a>) -> <a href="./src/openint/types/create_magic_link_response.py">CreateMagicLinkResponse</a></code>
- <code title="post /connect/token">client.<a href="./src/openint/_client.py">create_token</a>(\*\*<a href="src/openint/types/client_create_token_params.py">params</a>) -> <a href="./src/openint/types/create_token_response.py">CreateTokenResponse</a></code>
- <code title="get /connection">client.<a href="./src/openint/_client.py">get_connection</a>(\*\*<a href="src/openint/types/client_get_connection_params.py">params</a>) -> <a href="./src/openint/types/get_connection_response.py">GetConnectionResponse</a></code>
- <code title="get /connection/{id}">client.<a href="./src/openint/_client.py">get_connection</a>(id, \*\*<a href="src/openint/types/client_get_connection_params.py">params</a>) -> <a href="./src/openint/types/get_connection_response.py">GetConnectionResponse</a></code>
- <code title="get /connector-config">client.<a href="./src/openint/_client.py">list_connection_configs</a>(\*\*<a href="src/openint/types/client_list_connection_configs_params.py">params</a>) -> <a href="./src/openint/types/list_connection_configs_response.py">SyncOffsetPagination[ListConnectionConfigsResponse]</a></code>
- <code title="get /connection/{id}">client.<a href="./src/openint/_client.py">list_connections</a>(id, \*\*<a href="src/openint/types/client_list_connections_params.py">params</a>) -> <a href="./src/openint/types/list_connections_response.py">ListConnectionsResponse</a></code>
- <code title="get /connection">client.<a href="./src/openint/_client.py">list_connections</a>(\*\*<a href="src/openint/types/client_list_connections_params.py">params</a>) -> <a href="./src/openint/types/list_connections_response.py">SyncOffsetPagination[ListConnectionsResponse]</a></code>
- <code title="get /event">client.<a href="./src/openint/_client.py">list_events</a>(\*\*<a href="src/openint/types/client_list_events_params.py">params</a>) -> <a href="./src/openint/types/list_events_response.py">SyncOffsetPagination[ListEventsResponse]</a></code>
Loading