From 8283204201ba71aeee12d02313de53b588096faa Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Fri, 25 Jan 2019 00:22:54 -0600 Subject: [PATCH] Fix header for requests Encode to utf-8 to prevent errors if the device name is non-ascii --- resources/lib/emby/core/http.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/lib/emby/core/http.py b/resources/lib/emby/core/http.py index 904aefe5..a96c80c7 100644 --- a/resources/lib/emby/core/http.py +++ b/resources/lib/emby/core/http.py @@ -215,17 +215,17 @@ class HTTP(object): def _authorization(self, data): auth = "MediaBrowser " - auth += "Client=%s, " % self.config['app.name'] - auth += "Device=%s, " % self.config['app.device_name'] - auth += "DeviceId=%s, " % self.config['app.device_id'] - auth += "Version=%s" % self.config['app.version'] + auth += "Client=%s, " % self.config['app.name'].encode('utf-8') + auth += "Device=%s, " % self.config['app.device_name'].encode('utf-8') + auth += "DeviceId=%s, " % self.config['app.device_id'].encode('utf-8') + auth += "Version=%s" % self.config['app.version'].encode('utf-8') data['headers'].update({'Authorization': auth}) if self.config['auth.token']: - auth += ', UserId=%s' % self.config['auth.user_id'] - data['headers'].update({'Authorization': auth, 'X-MediaBrowser-Token': self.config['auth.token']}) + auth += ', UserId=%s' % self.config['auth.user_id'].encode('utf-8') + data['headers'].update({'Authorization': auth, 'X-MediaBrowser-Token': self.config['auth.token'].encode('utf-8')}) return data