File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626)
2727from ._utils import (
2828 is_given ,
29+ is_mapping_t ,
2930 maybe_transform ,
3031 get_async_library ,
3132 async_maybe_transform ,
@@ -101,6 +102,15 @@ def __init__(
101102 if base_url is None :
102103 base_url = f"https://api.steel.dev"
103104
105+ custom_headers_env = os .environ .get ("STEEL_CUSTOM_HEADERS" )
106+ if custom_headers_env is not None :
107+ parsed : dict [str , str ] = {}
108+ for line in custom_headers_env .split ("\n " ):
109+ colon = line .find (":" )
110+ if colon >= 0 :
111+ parsed [line [:colon ].strip ()] = line [colon + 1 :].strip ()
112+ default_headers = {** parsed , ** (default_headers if is_mapping_t (default_headers ) else {})}
113+
104114 super ().__init__ (
105115 version = __version__ ,
106116 base_url = base_url ,
@@ -466,6 +476,15 @@ def __init__(
466476 if base_url is None :
467477 base_url = f"https://api.steel.dev"
468478
479+ custom_headers_env = os .environ .get ("STEEL_CUSTOM_HEADERS" )
480+ if custom_headers_env is not None :
481+ parsed : dict [str , str ] = {}
482+ for line in custom_headers_env .split ("\n " ):
483+ colon = line .find (":" )
484+ if colon >= 0 :
485+ parsed [line [:colon ].strip ()] = line [colon + 1 :].strip ()
486+ default_headers = {** parsed , ** (default_headers if is_mapping_t (default_headers ) else {})}
487+
469488 super ().__init__ (
470489 version = __version__ ,
471490 base_url = base_url ,
You can’t perform that action at this time.
0 commit comments