File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121 RequestOptions ,
2222 not_given ,
2323)
24- from ._utils import is_given , get_async_library
24+ from ._utils import (
25+ is_given ,
26+ is_mapping_t ,
27+ get_async_library ,
28+ )
2529from ._compat import cached_property
2630from ._models import SecurityOptions
2731from ._version import __version__
@@ -118,6 +122,15 @@ def __init__(
118122 if base_url is None :
119123 base_url = f"https://api.tryfinch.com"
120124
125+ custom_headers_env = os .environ .get ("FINCH_CUSTOM_HEADERS" )
126+ if custom_headers_env is not None :
127+ parsed : dict [str , str ] = {}
128+ for line in custom_headers_env .split ("\n " ):
129+ colon = line .find (":" )
130+ if colon >= 0 :
131+ parsed [line [:colon ].strip ()] = line [colon + 1 :].strip ()
132+ default_headers = {** parsed , ** (default_headers if is_mapping_t (default_headers ) else {})}
133+
121134 super ().__init__ (
122135 version = __version__ ,
123136 base_url = base_url ,
@@ -460,6 +473,15 @@ def __init__(
460473 if base_url is None :
461474 base_url = f"https://api.tryfinch.com"
462475
476+ custom_headers_env = os .environ .get ("FINCH_CUSTOM_HEADERS" )
477+ if custom_headers_env is not None :
478+ parsed : dict [str , str ] = {}
479+ for line in custom_headers_env .split ("\n " ):
480+ colon = line .find (":" )
481+ if colon >= 0 :
482+ parsed [line [:colon ].strip ()] = line [colon + 1 :].strip ()
483+ default_headers = {** parsed , ** (default_headers if is_mapping_t (default_headers ) else {})}
484+
463485 super ().__init__ (
464486 version = __version__ ,
465487 base_url = base_url ,
You can’t perform that action at this time.
0 commit comments