Skip to content

Commit 0545469

Browse files
committed
Release 0.0.21
1 parent a5faa3c commit 0545469

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "axiomatic"
3-
version = "0.0.20"
3+
version = "0.0.21"
44
description = ""
55
readme = "README.md"
66
authors = []

src/axiomatic/client.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
import typing
44
from .environment import AxiomaticEnvironment
5+
import os
56
import httpx
7+
from .core.api_error import ApiError
68
from .core.client_wrapper import SyncClientWrapper
79
from .requirements.client import RequirementsClient
810
from .pic.client import PicClient
@@ -13,7 +15,6 @@
1315
from .core.request_options import RequestOptions
1416
from .core.pydantic_utilities import parse_obj_as
1517
from json.decoder import JSONDecodeError
16-
from .core.api_error import ApiError
1718
from .core.client_wrapper import AsyncClientWrapper
1819
from .requirements.client import AsyncRequirementsClient
1920
from .pic.client import AsyncPicClient
@@ -41,7 +42,7 @@ class Axiomatic:
4142
4243
4344
44-
api_key : str
45+
api_key : typing.Optional[str]
4546
timeout : typing.Optional[float]
4647
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
4748
@@ -65,12 +66,16 @@ def __init__(
6566
*,
6667
base_url: typing.Optional[str] = None,
6768
environment: AxiomaticEnvironment = AxiomaticEnvironment.DEFAULT,
68-
api_key: str,
69+
api_key: typing.Optional[str] = os.getenv("AXIOMATIC_API_KEY"),
6970
timeout: typing.Optional[float] = None,
7071
follow_redirects: typing.Optional[bool] = True,
7172
httpx_client: typing.Optional[httpx.Client] = None,
7273
):
7374
_defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
75+
if api_key is None:
76+
raise ApiError(
77+
body="The client must be instantiated be either passing in api_key or setting AXIOMATIC_API_KEY"
78+
)
7479
self._client_wrapper = SyncClientWrapper(
7580
base_url=_get_base_url(base_url=base_url, environment=environment),
7681
api_key=api_key,
@@ -149,7 +154,7 @@ class AsyncAxiomatic:
149154
150155
151156
152-
api_key : str
157+
api_key : typing.Optional[str]
153158
timeout : typing.Optional[float]
154159
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
155160
@@ -173,12 +178,16 @@ def __init__(
173178
*,
174179
base_url: typing.Optional[str] = None,
175180
environment: AxiomaticEnvironment = AxiomaticEnvironment.DEFAULT,
176-
api_key: str,
181+
api_key: typing.Optional[str] = os.getenv("AXIOMATIC_API_KEY"),
177182
timeout: typing.Optional[float] = None,
178183
follow_redirects: typing.Optional[bool] = True,
179184
httpx_client: typing.Optional[httpx.AsyncClient] = None,
180185
):
181186
_defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
187+
if api_key is None:
188+
raise ApiError(
189+
body="The client must be instantiated be either passing in api_key or setting AXIOMATIC_API_KEY"
190+
)
182191
self._client_wrapper = AsyncClientWrapper(
183192
base_url=_get_base_url(base_url=base_url, environment=environment),
184193
api_key=api_key,

src/axiomatic/core/client_wrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ def get_headers(self) -> typing.Dict[str, str]:
1616
headers: typing.Dict[str, str] = {
1717
"X-Fern-Language": "Python",
1818
"X-Fern-SDK-Name": "axiomatic",
19-
"X-Fern-SDK-Version": "0.0.20",
19+
"X-Fern-SDK-Version": "0.0.21",
2020
}
21-
headers["x-api-key"] = self.api_key
21+
headers["X-API-Key"] = self.api_key
2222
return headers
2323

2424
def get_base_url(self) -> str:

0 commit comments

Comments
 (0)