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 ,
@@ -113,6 +114,15 @@ def __init__(
113114 if base_url is None :
114115 base_url = f"http://localhost:23373"
115116
117+ custom_headers_env = os .environ .get ("BEEPER_DESKTOP_CUSTOM_HEADERS" )
118+ if custom_headers_env is not None :
119+ parsed : dict [str , str ] = {}
120+ for line in custom_headers_env .split ("\n " ):
121+ colon = line .find (":" )
122+ if colon >= 0 :
123+ parsed [line [:colon ].strip ()] = line [colon + 1 :].strip ()
124+ default_headers = {** parsed , ** (default_headers if is_mapping_t (default_headers ) else {})}
125+
116126 super ().__init__ (
117127 version = __version__ ,
118128 base_url = base_url ,
@@ -408,6 +418,15 @@ def __init__(
408418 if base_url is None :
409419 base_url = f"http://localhost:23373"
410420
421+ custom_headers_env = os .environ .get ("BEEPER_DESKTOP_CUSTOM_HEADERS" )
422+ if custom_headers_env is not None :
423+ parsed : dict [str , str ] = {}
424+ for line in custom_headers_env .split ("\n " ):
425+ colon = line .find (":" )
426+ if colon >= 0 :
427+ parsed [line [:colon ].strip ()] = line [colon + 1 :].strip ()
428+ default_headers = {** parsed , ** (default_headers if is_mapping_t (default_headers ) else {})}
429+
411430 super ().__init__ (
412431 version = __version__ ,
413432 base_url = base_url ,
You can’t perform that action at this time.
0 commit comments