@@ -96,10 +96,14 @@ def __init__(self, app_key=None, app_secret=None, oauth_token=None,
96
96
self .client = requests .Session ()
97
97
self .client .auth = auth
98
98
99
- for k , v in self .client_args :
99
+ # Make a copy of the client args and iterate over them
100
+ # Pop out all the acceptable args at this point because they will
101
+ # Never be used again.
102
+ client_args_copy = self .client_args .copy ()
103
+ for k , v in client_args_copy .items ():
100
104
if k in ('cert' , 'headers' , 'hooks' , 'max_redirects' , 'proxies' ):
101
105
setattr (self .client , k , v )
102
- client_args .pop (k )
106
+ self . client_args .pop (k ) # Pop, pop!
103
107
104
108
self ._last_call = None
105
109
@@ -115,10 +119,10 @@ def _request(self, url, method='GET', params=None, api_call=None):
115
119
params , files = _transparent_params (params )
116
120
117
121
requests_args = {}
118
- for k , v in self .client_args :
122
+ for k , v in self .client_args .items ():
123
+ # Maybe this should be set as a class variable and only done once?
119
124
if k in ('timeout' , 'allow_redirects' , 'stream' , 'verify' ):
120
125
requests_args [k ] = v
121
- self .client_args .pop (k )
122
126
123
127
if method == 'get' :
124
128
requests_args ['params' ] = params
0 commit comments