2020 RequestOptions ,
2121 not_given ,
2222)
23- from ._utils import is_given , get_async_library
23+ from ._utils import (
24+ is_given ,
25+ is_mapping_t ,
26+ get_async_library ,
27+ )
2428from ._compat import cached_property
2529from ._models import SecurityOptions
2630from ._version import __version__
3337)
3438
3539if TYPE_CHECKING :
36- from .resources import machines
40+ from .resources import orgs , machines
41+ from .resources .orgs .orgs import OrgsResource , AsyncOrgsResource
3742 from .resources .machines .machines import MachinesResource , AsyncMachinesResource
3843
3944__all__ = ["Timeout" , "Transport" , "ProxiesTypes" , "RequestOptions" , "Dedalus" , "AsyncDedalus" , "Client" , "AsyncClient" ]
@@ -105,6 +110,15 @@ def __init__(
105110 if base_url is None :
106111 base_url = f"https://dcs.dedaluslabs.ai"
107112
113+ custom_headers_env = os .environ .get ("DEDALUS_CUSTOM_HEADERS" )
114+ if custom_headers_env is not None :
115+ parsed : dict [str , str ] = {}
116+ for line in custom_headers_env .split ("\n " ):
117+ colon = line .find (":" )
118+ if colon >= 0 :
119+ parsed [line [:colon ].strip ()] = line [colon + 1 :].strip ()
120+ default_headers = {** parsed , ** (default_headers if is_mapping_t (default_headers ) else {})}
121+
108122 super ().__init__ (
109123 version = __version__ ,
110124 base_url = base_url ,
@@ -120,6 +134,12 @@ def __init__(
120134
121135 self ._default_stream_cls = Stream
122136
137+ @cached_property
138+ def orgs (self ) -> OrgsResource :
139+ from .resources .orgs import OrgsResource
140+
141+ return OrgsResource (self )
142+
123143 @cached_property
124144 def machines (self ) -> MachinesResource :
125145 from .resources .machines import MachinesResource
@@ -339,6 +359,15 @@ def __init__(
339359 if base_url is None :
340360 base_url = f"https://dcs.dedaluslabs.ai"
341361
362+ custom_headers_env = os .environ .get ("DEDALUS_CUSTOM_HEADERS" )
363+ if custom_headers_env is not None :
364+ parsed : dict [str , str ] = {}
365+ for line in custom_headers_env .split ("\n " ):
366+ colon = line .find (":" )
367+ if colon >= 0 :
368+ parsed [line [:colon ].strip ()] = line [colon + 1 :].strip ()
369+ default_headers = {** parsed , ** (default_headers if is_mapping_t (default_headers ) else {})}
370+
342371 super ().__init__ (
343372 version = __version__ ,
344373 base_url = base_url ,
@@ -354,6 +383,12 @@ def __init__(
354383
355384 self ._default_stream_cls = AsyncStream
356385
386+ @cached_property
387+ def orgs (self ) -> AsyncOrgsResource :
388+ from .resources .orgs import AsyncOrgsResource
389+
390+ return AsyncOrgsResource (self )
391+
357392 @cached_property
358393 def machines (self ) -> AsyncMachinesResource :
359394 from .resources .machines import AsyncMachinesResource
@@ -513,6 +548,12 @@ class DedalusWithRawResponse:
513548 def __init__ (self , client : Dedalus ) -> None :
514549 self ._client = client
515550
551+ @cached_property
552+ def orgs (self ) -> orgs .OrgsResourceWithRawResponse :
553+ from .resources .orgs import OrgsResourceWithRawResponse
554+
555+ return OrgsResourceWithRawResponse (self ._client .orgs )
556+
516557 @cached_property
517558 def machines (self ) -> machines .MachinesResourceWithRawResponse :
518559 from .resources .machines import MachinesResourceWithRawResponse
@@ -526,6 +567,12 @@ class AsyncDedalusWithRawResponse:
526567 def __init__ (self , client : AsyncDedalus ) -> None :
527568 self ._client = client
528569
570+ @cached_property
571+ def orgs (self ) -> orgs .AsyncOrgsResourceWithRawResponse :
572+ from .resources .orgs import AsyncOrgsResourceWithRawResponse
573+
574+ return AsyncOrgsResourceWithRawResponse (self ._client .orgs )
575+
529576 @cached_property
530577 def machines (self ) -> machines .AsyncMachinesResourceWithRawResponse :
531578 from .resources .machines import AsyncMachinesResourceWithRawResponse
@@ -539,6 +586,12 @@ class DedalusWithStreamedResponse:
539586 def __init__ (self , client : Dedalus ) -> None :
540587 self ._client = client
541588
589+ @cached_property
590+ def orgs (self ) -> orgs .OrgsResourceWithStreamingResponse :
591+ from .resources .orgs import OrgsResourceWithStreamingResponse
592+
593+ return OrgsResourceWithStreamingResponse (self ._client .orgs )
594+
542595 @cached_property
543596 def machines (self ) -> machines .MachinesResourceWithStreamingResponse :
544597 from .resources .machines import MachinesResourceWithStreamingResponse
@@ -552,6 +605,12 @@ class AsyncDedalusWithStreamedResponse:
552605 def __init__ (self , client : AsyncDedalus ) -> None :
553606 self ._client = client
554607
608+ @cached_property
609+ def orgs (self ) -> orgs .AsyncOrgsResourceWithStreamingResponse :
610+ from .resources .orgs import AsyncOrgsResourceWithStreamingResponse
611+
612+ return AsyncOrgsResourceWithStreamingResponse (self ._client .orgs )
613+
555614 @cached_property
556615 def machines (self ) -> machines .AsyncMachinesResourceWithStreamingResponse :
557616 from .resources .machines import AsyncMachinesResourceWithStreamingResponse
0 commit comments