Merge headers, don't overwrite.
This commit is contained in:
parent
673336ff8f
commit
31ff35349c
1 changed files with 5 additions and 1 deletions
|
|
@ -109,10 +109,14 @@ class Twython(EndpointsMixin, object):
|
||||||
# Never be used again.
|
# Never be used again.
|
||||||
client_args_copy = self.client_args.copy()
|
client_args_copy = self.client_args.copy()
|
||||||
for k, v in client_args_copy.items():
|
for k, v in client_args_copy.items():
|
||||||
if k in ('cert', 'headers', 'hooks', 'max_redirects', 'proxies'):
|
if k in ('cert', 'hooks', 'max_redirects', 'proxies'):
|
||||||
setattr(self.client, k, v)
|
setattr(self.client, k, v)
|
||||||
self.client_args.pop(k) # Pop, pop!
|
self.client_args.pop(k) # Pop, pop!
|
||||||
|
|
||||||
|
# Headers are always present, so we unconditionally pop them and merge
|
||||||
|
# them into the session headers.
|
||||||
|
self.client.headers.update(self.client_args.pop('headers'))
|
||||||
|
|
||||||
self._last_call = None
|
self._last_call = None
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue