@@ -72,16 +72,20 @@ def _put(url, data, files, auth, headers=None):
7272 return __return_wrapper (r )
7373
7474
75- def _get (url , params , auth ):
75+ def _get (url , params , auth , headers = None ):
7676 if _session is None :
7777 _init ()
7878 try :
79+ post_headers = _headers .copy ()
80+ if headers is not None :
81+ for k , v in headers .items ():
82+ post_headers .update ({k : v })
7983 r = _session .get (
8084 url ,
8185 params = params ,
82- auth = qiniu . auth . RequestsAuth ( auth ) if auth is not None else None ,
86+ auth = auth ,
8387 timeout = config .get_default ('connection_timeout' ),
84- headers = _headers )
88+ headers = post_headers )
8589 except Exception as e :
8690 return None , ResponseInfo (None , e )
8791 return __return_wrapper (r )
@@ -108,10 +112,18 @@ def _post_with_auth(url, data, auth):
108112 return _post (url , data , None , qiniu .auth .RequestsAuth (auth ))
109113
110114
115+ def _get_with_auth (url , data , auth ):
116+ return _get (url , data , qiniu .auth .RequestsAuth (auth ))
117+
118+
111119def _post_with_auth_and_headers (url , data , auth , headers ):
112120 return _post (url , data , None , qiniu .auth .RequestsAuth (auth ), headers )
113121
114122
123+ def _get_with_auth_and_headers (url , data , auth , headers ):
124+ return _get (url , data , qiniu .auth .RequestsAuth (auth ), headers )
125+
126+
115127def _post_with_qiniu_mac_and_headers (url , data , auth , headers ):
116128 return _post (url , data , None , qiniu .auth .QiniuMacRequestsAuth (auth ), headers )
117129
0 commit comments