destiny_sdk 0.7.4__py3-none-any.whl → 0.7.5__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.
destiny_sdk/client.py CHANGED
@@ -479,6 +479,7 @@ class OAuthClient:
479
479
  self,
480
480
  base_url: HttpUrl | str,
481
481
  auth: httpx.Auth | None = None,
482
+ timeout: int = 10,
482
483
  ) -> None:
483
484
  """
484
485
  Initialize the client.
@@ -490,6 +491,8 @@ class OAuthClient:
490
491
  instance of ``OAuthMiddleware``, unless you need to create a custom auth
491
492
  class.
492
493
  :type auth: httpx.Auth | None
494
+ :param timeout: The timeout for requests, in seconds. Defaults to 10 seconds.
495
+ :type timeout: int
493
496
  """
494
497
  self._client = httpx.Client(
495
498
  base_url=str(base_url).removesuffix("/").removesuffix("/v1") + "/v1",
@@ -497,6 +500,7 @@ class OAuthClient:
497
500
  "Content-Type": "application/json",
498
501
  "User-Agent": user_agent,
499
502
  },
503
+ timeout=timeout,
500
504
  )
501
505
 
502
506
  if auth:
@@ -529,6 +533,7 @@ class OAuthClient:
529
533
  annotations: list[str | AnnotationFilter] | None = None,
530
534
  sort: str | None = None,
531
535
  page: int = 1,
536
+ timeout: int | None = None,
532
537
  ) -> ReferenceSearchResult:
533
538
  """
534
539
  Send a search request to the Destiny Repository API.
@@ -547,6 +552,9 @@ class OAuthClient:
547
552
  :type sort: str | None
548
553
  :param page: The page number of results to retrieve.
549
554
  :type page: int
555
+ :param timeout: The timeout for the request, in seconds. If provided, this will override
556
+ the client timeout.
557
+ :type timeout: int | None
550
558
  :return: The response from the API.
551
559
  :rtype: libs.sdk.src.destiny_sdk.references.ReferenceSearchResult
552
560
  """ # noqa: E501
@@ -562,6 +570,7 @@ class OAuthClient:
562
570
  response = self._client.get(
563
571
  "/references/search/",
564
572
  params=params,
573
+ timeout=timeout or httpx.USE_CLIENT_DEFAULT,
565
574
  )
566
575
  self._raise_for_status(response)
567
576
  return ReferenceSearchResult.model_validate(response.json())
@@ -569,6 +578,7 @@ class OAuthClient:
569
578
  def lookup(
570
579
  self,
571
580
  identifiers: list[str | IdentifierLookup],
581
+ timeout: int | None = None,
572
582
  ) -> list[Reference]:
573
583
  """
574
584
  Lookup references by identifiers.
@@ -577,6 +587,9 @@ class OAuthClient:
577
587
 
578
588
  :param identifiers: The identifiers to look up.
579
589
  :type identifiers: list[str | libs.sdk.src.destiny_sdk.identifiers.IdentifierLookup]
590
+ :param timeout: The timeout for the request, in seconds. If provided, this will override
591
+ the client timeout.
592
+ :type timeout: int | None
580
593
  :return: The list of references matching the identifiers.
581
594
  :rtype: list[libs.sdk.src.destiny_sdk.references.Reference]
582
595
  """ # noqa: E501
@@ -585,6 +598,7 @@ class OAuthClient:
585
598
  params={
586
599
  "identifier": ",".join([str(identifier) for identifier in identifiers])
587
600
  },
601
+ timeout=timeout or httpx.USE_CLIENT_DEFAULT,
588
602
  )
589
603
  self._raise_for_status(response)
590
604
  return TypeAdapter(list[Reference]).validate_python(response.json())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: destiny_sdk
3
- Version: 0.7.4
3
+ Version: 0.7.5
4
4
  Summary: A software development kit (sdk) to support interaction with the DESTINY repository
5
5
  Author-email: Adam Hamilton <adam@futureevidence.org>, Andrew Harvey <andrew@futureevidence.org>, Daniel Breves <daniel@futureevidence.org>, Jack Walmisley <jack@futureevidence.org>, Tim Repke <tim.repke@pik-potsdam.de>
6
6
  License-Expression: Apache-2.0
@@ -1,6 +1,6 @@
1
1
  destiny_sdk/__init__.py,sha256=NdSlsPQyDF3TW30_JzbvYMRBRA9iT677iTRWWCMdYOA,382
2
2
  destiny_sdk/auth.py,sha256=bY72ywZEcG_67YBd9PrwgWTXkCf58rhLvVEXrtXbWtA,6247
3
- destiny_sdk/client.py,sha256=nKvS5rRkIpBqv8dVIB57Xsop0UvVz3i875RQxfVSMao,21306
3
+ destiny_sdk/client.py,sha256=XJi4LXrG6C_0aWSiEE27Ehmq17dE9MdaEOidb1ki_nY,21979
4
4
  destiny_sdk/core.py,sha256=E0Wotu9psggK1JRJxbvx3Jc7WEGE6zaz2R2awvRrLz8,2023
5
5
  destiny_sdk/enhancements.py,sha256=79-lXOowRPC3EdM3PZPkcbnVIj5Bnbp_GIlVuEYhLkM,15707
6
6
  destiny_sdk/identifiers.py,sha256=JoJvRBzK4pGTRB03mCaGPyjd32tqZLT5hnRgc9Yi95Q,9828
@@ -15,7 +15,7 @@ destiny_sdk/labs/references.py,sha256=iZisRgGZ5c7X7uTFoe6Q0AwwFMa4yJbIoPUVv_hvOi
15
15
  destiny_sdk/parsers/__init__.py,sha256=d5gS--bXla_0I7e_9wTBnGWMXt2U8b-_ndeprTPe1hk,149
16
16
  destiny_sdk/parsers/eppi_parser.py,sha256=_1xnAT0F0o1HKpMWOGQbVS3VPOrhPqyzHDWR3CosWwk,9484
17
17
  destiny_sdk/parsers/exceptions.py,sha256=0Sc_M4j560Nqh4SjeP_YrgOUVagdIwWwRz24E6YlZ1k,573
18
- destiny_sdk-0.7.4.dist-info/METADATA,sha256=Qb7_sEE2hy49aCE929t1SiSlHGZQXxeMLHPL_GCJp1k,2685
19
- destiny_sdk-0.7.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
20
- destiny_sdk-0.7.4.dist-info/licenses/LICENSE,sha256=6QURU4gvvTjVZ5rfp5amZ6FtFvcpPhAGUjxF5WSZAHI,9138
21
- destiny_sdk-0.7.4.dist-info/RECORD,,
18
+ destiny_sdk-0.7.5.dist-info/METADATA,sha256=fgalMU_UB56EZrHU-emwsc5QuSunDO0f1QEl5iMSlcU,2685
19
+ destiny_sdk-0.7.5.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
20
+ destiny_sdk-0.7.5.dist-info/licenses/LICENSE,sha256=6QURU4gvvTjVZ5rfp5amZ6FtFvcpPhAGUjxF5WSZAHI,9138
21
+ destiny_sdk-0.7.5.dist-info/RECORD,,