6868
6969def resolve_auth_headers (
7070 headers : Optional [Mapping [str , str ]],
71- http_auth : Union [DefaultType , None , Tuple [str , str ], str ] = DEFAULT ,
7271 api_key : Union [DefaultType , None , Tuple [str , str ], str ] = DEFAULT ,
7372 basic_auth : Union [DefaultType , None , Tuple [str , str ], str ] = DEFAULT ,
7473 bearer_auth : Union [DefaultType , None , str ] = DEFAULT ,
@@ -78,32 +77,7 @@ def resolve_auth_headers(
7877 elif not isinstance (headers , HttpHeaders ):
7978 headers = HttpHeaders (headers )
8079
81- resolved_http_auth = http_auth if http_auth is not DEFAULT else None
8280 resolved_basic_auth = basic_auth if basic_auth is not DEFAULT else None
83- if resolved_http_auth is not None :
84- if resolved_basic_auth is not None :
85- raise ValueError (
86- "Can't specify both 'http_auth' and 'basic_auth', "
87- "instead only specify 'basic_auth'"
88- )
89- if isinstance (http_auth , str ) or (
90- isinstance (resolved_http_auth , (list , tuple ))
91- and all (isinstance (x , str ) for x in resolved_http_auth )
92- ):
93- resolved_basic_auth = resolved_http_auth
94- else :
95- raise TypeError (
96- "The deprecated 'http_auth' parameter must be either 'Tuple[str, str]' or 'str'. "
97- "Use either the 'basic_auth' parameter instead"
98- )
99-
100- warnings .warn (
101- "The 'http_auth' parameter is deprecated. "
102- "Use 'basic_auth' or 'bearer_auth' parameters instead" ,
103- category = DeprecationWarning ,
104- stacklevel = warn_stacklevel (),
105- )
106-
10781 resolved_api_key = api_key if api_key is not DEFAULT else None
10882 resolved_bearer_auth = bearer_auth if bearer_auth is not DEFAULT else None
10983 if resolved_api_key or resolved_basic_auth or resolved_bearer_auth :
0 commit comments