Skip to content

Commit

Permalink
Merge pull request #363 from fronzbot/dev
Browse files Browse the repository at this point in the history
0.16.3
  • Loading branch information
fronzbot authored Aug 2, 2020
2 parents 6bd8d14 + 41d59b1 commit 19b7eef
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Changelog

A list of changes between each release

0.16.3 (2020-08-02)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Add user-agent to all headers

0.16.2 (2020-08-01)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
9 changes: 7 additions & 2 deletions blinkpy/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
from urllib3.util.retry import Retry
from blinkpy import api
from blinkpy.helpers import util
from blinkpy.helpers.constants import BLINK_URL, LOGIN_ENDPOINT, TIMEOUT
from blinkpy.helpers.constants import (
BLINK_URL,
DEFAULT_USER_AGENT,
LOGIN_ENDPOINT,
TIMEOUT,
)

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -53,7 +58,7 @@ def header(self):
"""Return authorization header."""
if self.token is None:
return None
return {"TOKEN_AUTH": self.token}
return {"TOKEN_AUTH": self.token, "user-agent": DEFAULT_USER_AGENT}

def create_session(self, opts=None):
"""Create a session for blink communication."""
Expand Down
2 changes: 1 addition & 1 deletion blinkpy/helpers/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

MAJOR_VERSION = 0
MINOR_VERSION = 16
PATCH_VERSION = 2
PATCH_VERSION = 3

__version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}.{PATCH_VERSION}"

Expand Down
2 changes: 1 addition & 1 deletion tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def test_response_bad_json(self):
def test_header(self):
"""Test header data."""
self.auth.token = "bar"
expected_header = {"TOKEN_AUTH": "bar"}
expected_header = {"TOKEN_AUTH": "bar", "user-agent": const.DEFAULT_USER_AGENT}
self.assertDictEqual(self.auth.header, expected_header)

def test_header_no_token(self):
Expand Down

0 comments on commit 19b7eef

Please sign in to comment.