Fixed issue with host name in header, added test to catch this

This commit is contained in:
Kevin Fronczak
2017-03-08 20:57:38 -05:00
parent d387a40154
commit 11b683a156
5 changed files with 8 additions and 3 deletions
+1
View File
@@ -9,3 +9,4 @@ dist/*
MANIFEST
README
.sh
build/*
+1 -1
View File
@@ -376,7 +376,7 @@ class Blink(object):
response = _request(LOGIN_URL, headers=headers, data=data, type='post')
self._TOKEN = response['authtoken']['authtoken']
(self._REGION_ID, self._REGION), = response['region'].items()
self._HOST = self._REGION + '.' + BLINK_URL
self._HOST = self._REGION_ID + '.' + BLINK_URL
self._AUTH_HEADER = {'Host': self._HOST,
'TOKEN_AUTH': self._TOKEN
}
+1 -1
View File
@@ -4,7 +4,7 @@ from setuptools import setup
setup(
name = 'blinkpy',
version = '0.4.',
version = '0.4.4',
description = 'A Blink camera Python library',
long_description='A library that communicates with Blink cameras',
author = 'Kevin Fronczak',
+1
View File
@@ -66,6 +66,7 @@ class TestBlinkRequests(unittest.TestCase):
self.assertEqual(name, const.CAMERA_NAME)
self.assertEqual(camera.armed, const.ARMED)
self.assertEqual(camera.motion['video'], BASE_URL + const.THUMB + '.mp4')
self.assertEqual(camera.header, const.auth_header)
elif camera.id == str(const.DEVICE_ID2):
self.assertEqual(name, const.CAMERA_NAME2)
self.assertEqual(camera.armed, const.ARMED2)
+4 -1
View File
@@ -24,7 +24,10 @@ if ISONLINE:
ONLINE = 'online'
else:
ONLINE = 'offline'
auth_header = {'Host': REGION_ID+'.immedia-semi.com',
'TOKEN_AUTH': TOKEN
}
response = {'account': {'notifications': 1},
'devices': [{'device_type': 'camera',