From aa5df127aea5619e7cf92eaaa253cea51a474839 Mon Sep 17 00:00:00 2001 From: amanagr Date: Sat, 31 Mar 2018 01:17:34 +0530 Subject: [PATCH] API: Use `session.headers.update` method to add user-agent header. Directly assigning session.headers overrides the default header paramers and removes `{'Accept-Encoding': 'gzip, deflate'}` from the headers. --- zulip/zulip/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zulip/zulip/__init__.py b/zulip/zulip/__init__.py index ac9d5a0..8731dba 100644 --- a/zulip/zulip/__init__.py +++ b/zulip/zulip/__init__.py @@ -414,7 +414,7 @@ class Client(object): session.auth = requests.auth.HTTPBasicAuth(self.email, self.api_key) session.verify = self.tls_verification # type: ignore # https://github.com/python/typeshed/pull/1504 session.cert = client_cert - session.headers = {"User-agent": self.get_user_agent()} + session.headers.update({"User-agent": self.get_user_agent()}) self.session = session def get_user_agent(self):