[twitch] Don't pollute default headers dict

This commit is contained in:
Sergey M․ 2018-09-17 22:14:28 +07:00
parent c11485162b
commit e2f61598be
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -51,7 +51,9 @@ def _handle_error(self, response):
expected=True)
def _call_api(self, path, item_id, *args, **kwargs):
kwargs.setdefault('headers', {})['Client-ID'] = self._CLIENT_ID
headers = kwargs.get('headers', {}).copy()
headers['Client-ID'] = self._CLIENT_ID
kwargs['headers'] = headers
response = self._download_json(
'%s/%s' % (self._API_BASE, path), item_id,
*args, **compat_kwargs(kwargs))