Skip to content

Commit 1097f03

Browse files
feat(api)!: Updating sdk auth schem
1 parent edfad25 commit 1097f03

10 files changed

+48
-198
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 10
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openint%2Fopenint-21dd873c4f72eb1599c52a65f085d6ba34b6aa35632111ae1ac1f39b133e642d.yml
3-
openapi_spec_hash: 43cbfe71f732c90beb90f8d33bd285ec
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openint%2Fopenint-fc7527fabd8beebd9c639bd6ac66f10ac26805db119cb625c67840c51f622dd9.yml
3+
openapi_spec_hash: 394209b9c4d294c6509002851a5448c8
44
config_hash: 68f87c7c6066f017748605b799b1c902

README.md

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,38 +24,23 @@ pip install openint
2424
The full API of this library can be found in [api.md](api.md).
2525

2626
```python
27-
import os
2827
from openint import Openint
2928

30-
client = Openint(
31-
token=os.environ.get(
32-
"OPENINT_API_KEY_OR_CUSTOMER_TOKEN"
33-
), # This is the default and can be omitted
34-
)
29+
client = Openint()
3530

3631
page = client.list_connections()
3732
print(page.items)
3833
```
3934

40-
While you can provide a `token` keyword argument,
41-
we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
42-
to add `OPENINT_API_KEY_OR_CUSTOMER_TOKEN="My Token"` to your `.env` file
43-
so that your Token is not stored in source control.
44-
4535
## Async usage
4636

4737
Simply import `AsyncOpenint` instead of `Openint` and use `await` with each API call:
4838

4939
```python
50-
import os
5140
import asyncio
5241
from openint import AsyncOpenint
5342

54-
client = AsyncOpenint(
55-
token=os.environ.get(
56-
"OPENINT_API_KEY_OR_CUSTOMER_TOKEN"
57-
), # This is the default and can be omitted
58-
)
43+
client = AsyncOpenint()
5944

6045

6146
async def main() -> None:

src/openint/_client.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,6 @@ def __init__(
130130
def qs(self) -> Querystring:
131131
return Querystring(array_format="comma")
132132

133-
@property
134-
@override
135-
def auth_headers(self) -> dict[str, str]:
136-
token = self.token
137-
if token is None:
138-
return {}
139-
return {"Authorization": f"Bearer {token}"}
140-
141133
@property
142134
@override
143135
def default_headers(self) -> dict[str, str | Omit]:
@@ -147,17 +139,6 @@ def default_headers(self) -> dict[str, str | Omit]:
147139
**self._custom_headers,
148140
}
149141

150-
@override
151-
def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None:
152-
if self.token and headers.get("Authorization"):
153-
return
154-
if isinstance(custom_headers.get("Authorization"), Omit):
155-
return
156-
157-
raise TypeError(
158-
'"Could not resolve authentication method. Expected the token to be set. Or for the `Authorization` headers to be explicitly omitted"'
159-
)
160-
161142
def copy(
162143
self,
163144
*,
@@ -898,14 +879,6 @@ def __init__(
898879
def qs(self) -> Querystring:
899880
return Querystring(array_format="comma")
900881

901-
@property
902-
@override
903-
def auth_headers(self) -> dict[str, str]:
904-
token = self.token
905-
if token is None:
906-
return {}
907-
return {"Authorization": f"Bearer {token}"}
908-
909882
@property
910883
@override
911884
def default_headers(self) -> dict[str, str | Omit]:
@@ -915,17 +888,6 @@ def default_headers(self) -> dict[str, str | Omit]:
915888
**self._custom_headers,
916889
}
917890

918-
@override
919-
def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None:
920-
if self.token and headers.get("Authorization"):
921-
return
922-
if isinstance(custom_headers.get("Authorization"), Omit):
923-
return
924-
925-
raise TypeError(
926-
'"Could not resolve authentication method. Expected the token to be set. Or for the `Authorization` headers to be explicitly omitted"'
927-
)
928-
929891
def copy(
930892
self,
931893
*,

src/openint/types/client_create_connection_params.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,9 +1180,6 @@ class DataConnectorQuickbooksDiscriminatedConnectionSettingsSettingsOAuth(TypedD
11801180
class DataConnectorQuickbooksDiscriminatedConnectionSettingsSettings(TypedDict, total=False):
11811181
oauth: Required[DataConnectorQuickbooksDiscriminatedConnectionSettingsSettingsOAuth]
11821182

1183-
realm_id: Required[Annotated[str, PropertyInfo(alias="realmId")]]
1184-
"""The realmId of your quickbooks company (e.g., 9341453474484455)"""
1185-
11861183

11871184
class DataConnectorQuickbooksDiscriminatedConnectionSettings(TypedDict, total=False):
11881185
connector_name: Required[Literal["quickbooks"]]

src/openint/types/create_connection_response.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,9 +1754,6 @@ class ConnectorQuickbooksDiscriminatedConnectionSettingsSettingsOAuth(BaseModel)
17541754
class ConnectorQuickbooksDiscriminatedConnectionSettingsSettings(BaseModel):
17551755
oauth: ConnectorQuickbooksDiscriminatedConnectionSettingsSettingsOAuth
17561756

1757-
realm_id: str = FieldInfo(alias="realmId")
1758-
"""The realmId of your quickbooks company (e.g., 9341453474484455)"""
1759-
17601757

17611758
class ConnectorQuickbooksDiscriminatedConnectionSettings(BaseModel):
17621759
connector_name: Literal["quickbooks"]

src/openint/types/get_connection_response.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5106,9 +5106,6 @@ class ConnectorQuickbooksDiscriminatedConnectionSettingsSettingsOAuth(BaseModel)
51065106
class ConnectorQuickbooksDiscriminatedConnectionSettingsSettings(BaseModel):
51075107
oauth: ConnectorQuickbooksDiscriminatedConnectionSettingsSettingsOAuth
51085108

5109-
realm_id: str = FieldInfo(alias="realmId")
5110-
"""The realmId of your quickbooks company (e.g., 9341453474484455)"""
5111-
51125109

51135110
class ConnectorQuickbooksDiscriminatedConnectionSettings(BaseModel):
51145111
connector_name: Literal["quickbooks"]

src/openint/types/list_connection_configs_response.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4330,8 +4330,6 @@ class ConnectorQuickbooksDiscriminatedConnectorConfigConfigOAuth(BaseModel):
43304330

43314331

43324332
class ConnectorQuickbooksDiscriminatedConnectorConfigConfig(BaseModel):
4333-
env_name: Literal["sandbox", "production"] = FieldInfo(alias="envName")
4334-
43354333
oauth: Optional[ConnectorQuickbooksDiscriminatedConnectorConfigConfigOAuth] = None
43364334
"""Base oauth configuration for the connector"""
43374335

src/openint/types/list_connections_response.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5106,9 +5106,6 @@ class ConnectorQuickbooksDiscriminatedConnectionSettingsSettingsOAuth(BaseModel)
51065106
class ConnectorQuickbooksDiscriminatedConnectionSettingsSettings(BaseModel):
51075107
oauth: ConnectorQuickbooksDiscriminatedConnectionSettingsSettingsOAuth
51085108

5109-
realm_id: str = FieldInfo(alias="realmId")
5110-
"""The realmId of your quickbooks company (e.g., 9341453474484455)"""
5111-
51125109

51135110
class ConnectorQuickbooksDiscriminatedConnectionSettings(BaseModel):
51145111
connector_name: Literal["quickbooks"]

tests/conftest.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,14 @@ def pytest_collection_modifyitems(items: list[pytest.Function]) -> None:
2828

2929
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
3030

31-
token = "My Token"
32-
3331

3432
@pytest.fixture(scope="session")
3533
def client(request: FixtureRequest) -> Iterator[Openint]:
3634
strict = getattr(request, "param", True)
3735
if not isinstance(strict, bool):
3836
raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}")
3937

40-
with Openint(base_url=base_url, token=token, _strict_response_validation=strict) as client:
38+
with Openint(base_url=base_url, _strict_response_validation=strict) as client:
4139
yield client
4240

4341

@@ -47,5 +45,5 @@ async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncOpenint]:
4745
if not isinstance(strict, bool):
4846
raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}")
4947

50-
async with AsyncOpenint(base_url=base_url, token=token, _strict_response_validation=strict) as client:
48+
async with AsyncOpenint(base_url=base_url, _strict_response_validation=strict) as client:
5149
yield client

0 commit comments

Comments
 (0)