File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222 RequestOptions ,
2323 not_given ,
2424)
25- from ._utils import is_given , get_async_library
25+ from ._utils import (
26+ is_given ,
27+ is_mapping_t ,
28+ get_async_library ,
29+ )
2630from ._compat import cached_property
2731from ._version import __version__
2832from ._response import to_streamed_response_wrapper , async_to_streamed_response_wrapper
@@ -197,6 +201,15 @@ def __init__(
197201 except KeyError as exc :
198202 raise ValueError (f"Unknown environment: { environment } " ) from exc
199203
204+ custom_headers_env = os .environ .get ("LITHIC_CUSTOM_HEADERS" )
205+ if custom_headers_env is not None :
206+ parsed : dict [str , str ] = {}
207+ for line in custom_headers_env .split ("\n " ):
208+ colon = line .find (":" )
209+ if colon >= 0 :
210+ parsed [line [:colon ].strip ()] = line [colon + 1 :].strip ()
211+ default_headers = {** parsed , ** (default_headers if is_mapping_t (default_headers ) else {})}
212+
200213 super ().__init__ (
201214 version = __version__ ,
202215 base_url = base_url ,
@@ -612,6 +625,15 @@ def __init__(
612625 except KeyError as exc :
613626 raise ValueError (f"Unknown environment: { environment } " ) from exc
614627
628+ custom_headers_env = os .environ .get ("LITHIC_CUSTOM_HEADERS" )
629+ if custom_headers_env is not None :
630+ parsed : dict [str , str ] = {}
631+ for line in custom_headers_env .split ("\n " ):
632+ colon = line .find (":" )
633+ if colon >= 0 :
634+ parsed [line [:colon ].strip ()] = line [colon + 1 :].strip ()
635+ default_headers = {** parsed , ** (default_headers if is_mapping_t (default_headers ) else {})}
636+
615637 super ().__init__ (
616638 version = __version__ ,
617639 base_url = base_url ,
You can’t perform that action at this time.
0 commit comments