Skip to content

Commit

Permalink
Add notification key to login
Browse files Browse the repository at this point in the history
  • Loading branch information
mkmer committed Jan 14, 2024
1 parent 5146b36 commit 3dc4948
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions blinkpy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ async def request_login(
auth,
url,
login_data,
notification_key,
is_retry=False,
):
"""
Expand All @@ -37,6 +38,9 @@ async def request_login(
"Content-Type": "application/json",
"user-agent": DEFAULT_USER_AGENT,
}
if notification_key:
headers["notification_key"] = notification_key

data = dumps(
{
"email": login_data["username"],
Expand Down
3 changes: 3 additions & 0 deletions blinkpy/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def __init__(
session=None,
agent=DEFAULT_USER_AGENT,
app_build=APP_BUILD,
notificaiton_key=None,
):
"""
Initialize auth handler.
Expand All @@ -54,6 +55,7 @@ def __init__(
self._agent = agent
self._app_build = app_build
self.session = session if session else ClientSession()
self._notification_key = notificaiton_key

@property
def login_attributes(self):
Expand Down Expand Up @@ -94,6 +96,7 @@ async def login(self, login_url=LOGIN_ENDPOINT):
login_url,
self.data,
is_retry=False,
notification_key=self._notification_key,
)
try:
if response.status == 200:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class TestAuth(IsolatedAsyncioTestCase):

def setUp(self):
"""Set up Login Handler."""
self.auth = Auth()
self.auth = Auth(notificaiton_key="testkey")

def tearDown(self):
"""Clean up after test."""
Expand Down

0 comments on commit 3dc4948

Please sign in to comment.