udl-sdk 0.1.0a16__py3-none-any.whl → 0.1.0a17__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: udl-sdk
3
- Version: 0.1.0a16
3
+ Version: 0.1.0a17
4
4
  Summary: The official Python library for the unifieddatalibrary API
5
5
  Project-URL: Homepage, https://github.com/Bluestaq/udl-python-sdk
6
6
  Project-URL: Repository, https://github.com/Bluestaq/udl-python-sdk
@@ -1,6 +1,6 @@
1
1
  unifieddatalibrary/__init__.py,sha256=562u3LZ5X6bc29nGRt5uXC91XbddnlSfk7tSqKA4yVk,2727
2
2
  unifieddatalibrary/_base_client.py,sha256=BeN6_E2mC2gbNLe35cF--RaIrSGhGXZ5PV0RETLnoxA,67692
3
- unifieddatalibrary/_client.py,sha256=mrBWoR1advnC0xyt7nMU-eiLqRf8ZBFqU8xFsrP4grU,136998
3
+ unifieddatalibrary/_client.py,sha256=1YrguzziaItqgqEU_CmlDsUdBcBjKr17HA8EVMSLvfw,139032
4
4
  unifieddatalibrary/_compat.py,sha256=VWemUKbj6DDkQ-O4baSpHVLJafotzeXmCQGJugfVTIw,6580
5
5
  unifieddatalibrary/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
6
6
  unifieddatalibrary/_exceptions.py,sha256=rkk8r4oyqb4bxjMtx0OFWsh1m8gsMfrnIGnNPO6zRz0,3244
@@ -11,7 +11,7 @@ unifieddatalibrary/_resource.py,sha256=Ik-pULzkvFIY2OgB9Ra7mIQKCle38FSP36dWWCH9v
11
11
  unifieddatalibrary/_response.py,sha256=hdekMRMvxTvYdKfYIPvAxSpdiuRILRCYd5Dwcye-icg,28890
12
12
  unifieddatalibrary/_streaming.py,sha256=LwKrocz7ZRmYd47TA3q-PLXwgdTgjANE-TCIRZB958s,10148
13
13
  unifieddatalibrary/_types.py,sha256=mslWUKYM1Q3bMXxgq4Mr9fo3QvAwzQJrscV44EPbmGA,6209
14
- unifieddatalibrary/_version.py,sha256=bWzWPOjM3DpaNc2DUOE7yLUFrM3ZgHlIFsh7_xmI52A,179
14
+ unifieddatalibrary/_version.py,sha256=I4gSFbLVU5pg8fGBseAmxOT-y9miBJimqgCF_ZwwlZY,179
15
15
  unifieddatalibrary/pagination.py,sha256=jRNsKPCwBHKIHIIX5V5yB7NUsvfy-k7UqnpPGrGyFNU,5758
16
16
  unifieddatalibrary/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  unifieddatalibrary/_utils/__init__.py,sha256=PNZ_QJuzZEgyYXqkO1HVhGkj5IU9bglVUcw7H-Knjzw,2062
@@ -2634,7 +2634,7 @@ unifieddatalibrary/types/weather_report/history_count_params.py,sha256=KFXFsL7q4
2634
2634
  unifieddatalibrary/types/weather_report/history_count_response.py,sha256=ZAHTF5IoOvMAg9GyvtMvgeowh-ythtIJhcWtMbcM8wk,202
2635
2635
  unifieddatalibrary/types/weather_report/history_list_params.py,sha256=JUd53E70wjtn7HlQ7LOZ7lUJREDJkaDYHv2eYW60T3Q,1019
2636
2636
  unifieddatalibrary/types/weather_report/weather_report_full.py,sha256=iv7fHg9aQh6ztvl0ztve5Z3_8Ww-efPMBgrS0n5gXvM,20751
2637
- udl_sdk-0.1.0a16.dist-info/METADATA,sha256=SrG90u4GaJxzJpydQCE-la4gBG907IsenkytiAJjBvs,17014
2638
- udl_sdk-0.1.0a16.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
2639
- udl_sdk-0.1.0a16.dist-info/licenses/LICENSE,sha256=YBMC8KbJHXtxIo1-d_G5WdWjtiwFyrcZ5jAsRwN4POI,11348
2640
- udl_sdk-0.1.0a16.dist-info/RECORD,,
2637
+ udl_sdk-0.1.0a17.dist-info/METADATA,sha256=E1gLINcZVaM7C6kxcdejyf4bw4av4zurKfFNCi5i5EU,17014
2638
+ udl_sdk-0.1.0a17.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
2639
+ udl_sdk-0.1.0a17.dist-info/licenses/LICENSE,sha256=YBMC8KbJHXtxIo1-d_G5WdWjtiwFyrcZ5jAsRwN4POI,11348
2640
+ udl_sdk-0.1.0a17.dist-info/RECORD,,
@@ -14,6 +14,7 @@ from ._qs import Querystring
14
14
  from ._types import (
15
15
  NOT_GIVEN,
16
16
  Omit,
17
+ Headers,
17
18
  Timeout,
18
19
  NotGiven,
19
20
  Transport,
@@ -117,7 +118,7 @@ from .resources import (
117
118
  seradata_spacecraft_details,
118
119
  )
119
120
  from ._streaming import Stream as Stream, AsyncStream as AsyncStream
120
- from ._exceptions import APIStatusError, UnifieddatalibraryError
121
+ from ._exceptions import APIStatusError
121
122
  from ._base_client import (
122
123
  DEFAULT_MAX_RETRIES,
123
124
  SyncAPIClient,
@@ -377,14 +378,16 @@ class Unifieddatalibrary(SyncAPIClient):
377
378
  with_streaming_response: UnifieddatalibraryWithStreamedResponse
378
379
 
379
380
  # client options
380
- password: str
381
- username: str
381
+ password: str | None
382
+ username: str | None
383
+ access_token: str | None
382
384
 
383
385
  def __init__(
384
386
  self,
385
387
  *,
386
388
  password: str | None = None,
387
389
  username: str | None = None,
390
+ access_token: str | None = None,
388
391
  base_url: str | httpx.URL | None = None,
389
392
  timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
390
393
  max_retries: int = DEFAULT_MAX_RETRIES,
@@ -409,23 +412,20 @@ class Unifieddatalibrary(SyncAPIClient):
409
412
  This automatically infers the following arguments from their corresponding environment variables if they are not provided:
410
413
  - `password` from `UDL_AUTH_PASSWORD`
411
414
  - `username` from `UDL_AUTH_USERNAME`
415
+ - `access_token` from `UDL_ACCESS_TOKEN`
412
416
  """
413
417
  if password is None:
414
418
  password = os.environ.get("UDL_AUTH_PASSWORD")
415
- if password is None:
416
- raise UnifieddatalibraryError(
417
- "The password client option must be set either by passing password to the client or by setting the UDL_AUTH_PASSWORD environment variable"
418
- )
419
419
  self.password = password
420
420
 
421
421
  if username is None:
422
422
  username = os.environ.get("UDL_AUTH_USERNAME")
423
- if username is None:
424
- raise UnifieddatalibraryError(
425
- "The username client option must be set either by passing username to the client or by setting the UDL_AUTH_USERNAME environment variable"
426
- )
427
423
  self.username = username
428
424
 
425
+ if access_token is None:
426
+ access_token = os.environ.get("UDL_ACCESS_TOKEN")
427
+ self.access_token = access_token
428
+
429
429
  if base_url is None:
430
430
  base_url = os.environ.get("UNIFIEDDATALIBRARY_BASE_URL")
431
431
  self._base_url_overridden = base_url is not None
@@ -618,10 +618,25 @@ class Unifieddatalibrary(SyncAPIClient):
618
618
  @property
619
619
  @override
620
620
  def auth_headers(self) -> dict[str, str]:
621
+ return {**self._basic_auth, **self._bearer_auth}
622
+
623
+ @property
624
+ def _basic_auth(self) -> dict[str, str]:
625
+ if self.username is None:
626
+ return {}
627
+ if self.password is None:
628
+ return {}
621
629
  credentials = f"{self.username}:{self.password}".encode("ascii")
622
630
  header = f"Basic {base64.b64encode(credentials).decode('ascii')}"
623
631
  return {"Authorization": header}
624
632
 
633
+ @property
634
+ def _bearer_auth(self) -> dict[str, str]:
635
+ access_token = self.access_token
636
+ if access_token is None:
637
+ return {}
638
+ return {"Authorization": f"Bearer {access_token}"}
639
+
625
640
  @property
626
641
  @override
627
642
  def default_headers(self) -> dict[str, str | Omit]:
@@ -631,11 +646,28 @@ class Unifieddatalibrary(SyncAPIClient):
631
646
  **self._custom_headers,
632
647
  }
633
648
 
649
+ @override
650
+ def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None:
651
+ if self.username and self.password and headers.get("Authorization"):
652
+ return
653
+ if isinstance(custom_headers.get("Authorization"), Omit):
654
+ return
655
+
656
+ if self.access_token and headers.get("Authorization"):
657
+ return
658
+ if isinstance(custom_headers.get("Authorization"), Omit):
659
+ return
660
+
661
+ raise TypeError(
662
+ '"Could not resolve authentication method. Expected either username, password or access_token to be set. Or for one of the `Authorization` or `Authorization` headers to be explicitly omitted"'
663
+ )
664
+
634
665
  def copy(
635
666
  self,
636
667
  *,
637
668
  password: str | None = None,
638
669
  username: str | None = None,
670
+ access_token: str | None = None,
639
671
  base_url: str | httpx.URL | None = None,
640
672
  timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
641
673
  http_client: httpx.Client | None = None,
@@ -671,6 +703,7 @@ class Unifieddatalibrary(SyncAPIClient):
671
703
  client = self.__class__(
672
704
  password=password or self.password,
673
705
  username=username or self.username,
706
+ access_token=access_token or self.access_token,
674
707
  base_url=base_url or self.base_url,
675
708
  timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
676
709
  http_client=http_client,
@@ -889,14 +922,16 @@ class AsyncUnifieddatalibrary(AsyncAPIClient):
889
922
  with_streaming_response: AsyncUnifieddatalibraryWithStreamedResponse
890
923
 
891
924
  # client options
892
- password: str
893
- username: str
925
+ password: str | None
926
+ username: str | None
927
+ access_token: str | None
894
928
 
895
929
  def __init__(
896
930
  self,
897
931
  *,
898
932
  password: str | None = None,
899
933
  username: str | None = None,
934
+ access_token: str | None = None,
900
935
  base_url: str | httpx.URL | None = None,
901
936
  timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
902
937
  max_retries: int = DEFAULT_MAX_RETRIES,
@@ -921,23 +956,20 @@ class AsyncUnifieddatalibrary(AsyncAPIClient):
921
956
  This automatically infers the following arguments from their corresponding environment variables if they are not provided:
922
957
  - `password` from `UDL_AUTH_PASSWORD`
923
958
  - `username` from `UDL_AUTH_USERNAME`
959
+ - `access_token` from `UDL_ACCESS_TOKEN`
924
960
  """
925
961
  if password is None:
926
962
  password = os.environ.get("UDL_AUTH_PASSWORD")
927
- if password is None:
928
- raise UnifieddatalibraryError(
929
- "The password client option must be set either by passing password to the client or by setting the UDL_AUTH_PASSWORD environment variable"
930
- )
931
963
  self.password = password
932
964
 
933
965
  if username is None:
934
966
  username = os.environ.get("UDL_AUTH_USERNAME")
935
- if username is None:
936
- raise UnifieddatalibraryError(
937
- "The username client option must be set either by passing username to the client or by setting the UDL_AUTH_USERNAME environment variable"
938
- )
939
967
  self.username = username
940
968
 
969
+ if access_token is None:
970
+ access_token = os.environ.get("UDL_ACCESS_TOKEN")
971
+ self.access_token = access_token
972
+
941
973
  if base_url is None:
942
974
  base_url = os.environ.get("UNIFIEDDATALIBRARY_BASE_URL")
943
975
  self._base_url_overridden = base_url is not None
@@ -1130,10 +1162,25 @@ class AsyncUnifieddatalibrary(AsyncAPIClient):
1130
1162
  @property
1131
1163
  @override
1132
1164
  def auth_headers(self) -> dict[str, str]:
1165
+ return {**self._basic_auth, **self._bearer_auth}
1166
+
1167
+ @property
1168
+ def _basic_auth(self) -> dict[str, str]:
1169
+ if self.username is None:
1170
+ return {}
1171
+ if self.password is None:
1172
+ return {}
1133
1173
  credentials = f"{self.username}:{self.password}".encode("ascii")
1134
1174
  header = f"Basic {base64.b64encode(credentials).decode('ascii')}"
1135
1175
  return {"Authorization": header}
1136
1176
 
1177
+ @property
1178
+ def _bearer_auth(self) -> dict[str, str]:
1179
+ access_token = self.access_token
1180
+ if access_token is None:
1181
+ return {}
1182
+ return {"Authorization": f"Bearer {access_token}"}
1183
+
1137
1184
  @property
1138
1185
  @override
1139
1186
  def default_headers(self) -> dict[str, str | Omit]:
@@ -1143,11 +1190,28 @@ class AsyncUnifieddatalibrary(AsyncAPIClient):
1143
1190
  **self._custom_headers,
1144
1191
  }
1145
1192
 
1193
+ @override
1194
+ def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None:
1195
+ if self.username and self.password and headers.get("Authorization"):
1196
+ return
1197
+ if isinstance(custom_headers.get("Authorization"), Omit):
1198
+ return
1199
+
1200
+ if self.access_token and headers.get("Authorization"):
1201
+ return
1202
+ if isinstance(custom_headers.get("Authorization"), Omit):
1203
+ return
1204
+
1205
+ raise TypeError(
1206
+ '"Could not resolve authentication method. Expected either username, password or access_token to be set. Or for one of the `Authorization` or `Authorization` headers to be explicitly omitted"'
1207
+ )
1208
+
1146
1209
  def copy(
1147
1210
  self,
1148
1211
  *,
1149
1212
  password: str | None = None,
1150
1213
  username: str | None = None,
1214
+ access_token: str | None = None,
1151
1215
  base_url: str | httpx.URL | None = None,
1152
1216
  timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
1153
1217
  http_client: httpx.AsyncClient | None = None,
@@ -1183,6 +1247,7 @@ class AsyncUnifieddatalibrary(AsyncAPIClient):
1183
1247
  client = self.__class__(
1184
1248
  password=password or self.password,
1185
1249
  username=username or self.username,
1250
+ access_token=access_token or self.access_token,
1186
1251
  base_url=base_url or self.base_url,
1187
1252
  timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
1188
1253
  http_client=http_client,
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "unifieddatalibrary"
4
- __version__ = "0.1.0-alpha.16" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.17" # x-release-please-version