File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3939)
4040from ._utils import (
4141 is_given ,
42+ is_mapping_t ,
4243 extract_files ,
4344 maybe_transform ,
4445 get_async_library ,
@@ -200,6 +201,15 @@ def __init__(
200201 except KeyError as exc :
201202 raise ValueError (f"Unknown environment: { environment } " ) from exc
202203
204+ custom_headers_env = os .environ .get ("LANDINGAI_ADE_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+
203213 super ().__init__ (
204214 version = __version__ ,
205215 base_url = base_url ,
@@ -887,6 +897,15 @@ def __init__(
887897 except KeyError as exc :
888898 raise ValueError (f"Unknown environment: { environment } " ) from exc
889899
900+ custom_headers_env = os .environ .get ("LANDINGAI_ADE_CUSTOM_HEADERS" )
901+ if custom_headers_env is not None :
902+ parsed : dict [str , str ] = {}
903+ for line in custom_headers_env .split ("\n " ):
904+ colon = line .find (":" )
905+ if colon >= 0 :
906+ parsed [line [:colon ].strip ()] = line [colon + 1 :].strip ()
907+ default_headers = {** parsed , ** (default_headers if is_mapping_t (default_headers ) else {})}
908+
890909 super ().__init__ (
891910 version = __version__ ,
892911 base_url = base_url ,
You can’t perform that action at this time.
0 commit comments