Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/jeffreydwalter/arlo
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreydwalter committed Nov 16, 2022
2 parents 0bd8b7d + c87aca1 commit e1d62c9
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 21 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [2.7, 3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
python -m pip install http
python -m pip install responses
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
#python -m pip install http
#python -m pip install responses
pip install --use-pep517 -r requirements.txt
# - name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
Expand Down
4 changes: 2 additions & 2 deletions arlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def LoginMFA(self, username, password, google_credential_file):
factor_auth_code = start_auth_body['data']['factorAuthCode']

# search for MFA token in latest emails
pattern = '\d{6}'
pattern = r'\d{6}'
code = None
service = build('gmail', 'v1', credentials = self.google_credentials)

Expand Down Expand Up @@ -1755,4 +1755,4 @@ def StopRecording(self, camera):

def GetCvrPlaylist(self, camera, fromDate, toDate):
""" This function downloads a Cvr Playlist file for the period fromDate to toDate. """
return self.request.get(f'https://{self.BASE_URL}/hmsweb/users/devices/'+camera.get('deviceId')+'/playlist?fromDate='+fromDate+'&toDate='+toDate)
return self.request.get(f'https://{self.BASE_URL}/hmsweb/users/devices/'+camera.get('uniqueId')+'/playlist?fromDate='+fromDate+'&toDate='+toDate)
57 changes: 55 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,80 @@
#
# This file is autogenerated by pip-compile
# This file is autogenerated by pip-compile with python 3.9
# To update, run:
#
# pip-compile
#
cachetools==5.2.0
# via google-auth
certifi==2019.9.11
# via requests
chardet==3.0.4
# via requests
google-api-core==2.10.2
# via google-api-python-client
google-api-python-client==2.66.0
# via arlo (setup.py)
google-auth==2.14.1
# via
# google-api-core
# google-api-python-client
# google-auth-httplib2
# google-auth-oauthlib
google-auth-httplib2==0.1.0
# via google-api-python-client
google-auth-oauthlib==0.7.1
# via arlo (setup.py)
googleapis-common-protos==1.57.0
# via google-api-core
httplib2==0.21.0
# via
# google-api-python-client
# google-auth-httplib2
idna==2.8
# via requests
monotonic==1.5
# via arlo (setup.py)
oauthlib==3.2.2
# via requests-oauthlib
pickle-mixin==1.0.2
# via arlo (setup.py)
protobuf==4.21.9
# via
# google-api-core
# googleapis-common-protos
pyasn1==0.4.8
# via
# pyasn1-modules
# rsa
pyasn1-modules==0.2.8
# via google-auth
pyparsing==3.0.9
# via httplib2
pysocks==1.7.1
# via arlo (setup.py)
requests==2.25.1
# via
# arlo (setup.py)
# google-api-core
# requests-oauthlib
# responses
# sseclient
requests-oauthlib==1.3.1
# via google-auth-oauthlib
responses==0.10.15
# via arlo (setup.py)
rsa==4.9
# via google-auth
six==1.13.0
# via sseclient
# via
# google-auth
# google-auth-httplib2
# responses
# sseclient
sseclient==0.0.22
# via arlo (setup.py)
uritemplate==4.1.1
# via google-api-python-client
urllib3==1.24
# via
# arlo (setup.py)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def readme():
url='https://github.com/jeffreydwalter/arlo',
license='Apache Software License',
include_package_data=True,
install_requires=['monotonic', 'requests', 'urllib3==1.24', 'sseclient==0.0.22', 'PySocks', 'pickle-mixin', 'google-api-python-client', 'google-auth-oauthlib'],
install_requires=['monotonic', 'requests', 'responses==0.10.15', 'urllib3==1.24', 'sseclient==0.0.22', 'PySocks', 'pickle-mixin', 'google-api-python-client', 'google-auth-oauthlib'],
keywords=[
'arlo',
'camera',
Expand Down
Empty file removed tests/__init__.py
Empty file.
35 changes: 25 additions & 10 deletions tests/test_arlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@

USERNAME = 'user@example.com'
PASSWORD = 'supersecretpassword'
LOGIN_JSON = json.load(open('./responses/expected_login_response.json'))
LOGIN_JSON = json.load(open('./tests/responses/expected_login_response.json'))

class TestArlo(unittest.TestCase):
def setUp(self):
"""
"""
"""
mocked_login_url = "https://my.arlo.com/hmsweb/login/v2"
Expand All @@ -26,7 +27,21 @@ def setUp(self):
json = LOGIN_JSON,
status = 200
)

"""
mocked_auth_url = "https://ocapi-app.arlo.com/api/auth"
responses.add(
method = responses.OPTIONS,
url = mocked_auth_url,
json = LOGIN_JSON,
status = 200
)
responses.add(
method = responses.POST,
url = mocked_auth_url,
json = LOGIN_JSON,
status = 200
)

@responses.activate
def test_login(self):
"""
Expand All @@ -43,7 +58,7 @@ def test_get_profile(self):
mocked_url = "https://my.arlo.com/hmsweb/users/profile"
mock_json = {}

with open('./responses/expected_get_profile_response.json') as json_file:
with open('./tests/responses/expected_get_profile_response.json') as json_file:
mock_json = json.load(json_file)

responses.add(
Expand All @@ -66,7 +81,7 @@ def test_get_account(self):
mocked_url = "https://my.arlo.com/hmsweb/users/account"
mock_json = {}

with open('./responses/expected_get_account_response.json') as json_file:
with open('./tests/responses/expected_get_account_response.json') as json_file:
mock_json = json.load(json_file)

responses.add(
Expand All @@ -88,7 +103,7 @@ def test_get_devices(self):
mocked_url = "https://my.arlo.com/hmsweb/users/devices"
mock_json = {}

with open('./responses/expected_get_devices_response.json') as json_file:
with open('./tests/responses/expected_get_devices_response.json') as json_file:
mock_json = json.load(json_file)

responses.add(
Expand All @@ -110,7 +125,7 @@ def test_get_locations(self):
mocked_url = "https://my.arlo.com/hmsweb/users/locations"
mock_json = {}

with open('./responses/expected_get_locations_response.json') as json_file:
with open('./tests/responses/expected_get_locations_response.json') as json_file:
mock_json = json.load(json_file)

responses.add(
Expand All @@ -132,7 +147,7 @@ def test_get_friends(self):
mocked_url = "https://my.arlo.com/hmsweb/users/friends"
mock_json = {}

with open('./responses/expected_get_friends_response.json') as json_file:
with open('./tests/responses/expected_get_friends_response.json') as json_file:
mock_json = json.load(json_file)

responses.add(
Expand All @@ -154,7 +169,7 @@ def test_get_service_level_v4(self):
mocked_url = "https://my.arlo.com/hmsweb/users/serviceLevel/v4"
mock_json = {}

with open('./responses/expected_get_service_level_v4_response.json') as json_file:
with open('./tests/responses/expected_get_service_level_v4_response.json') as json_file:
mock_json = json.load(json_file)

responses.add(
Expand All @@ -176,7 +191,7 @@ def test_get_payment_offers_v4(self):
mocked_url = "https://my.arlo.com/hmsweb/users/payment/offers/v4"
mock_json = {}

with open('./responses/expected_get_payment_offers_v4_response.json') as json_file:
with open('./tests/responses/expected_get_payment_offers_v4_response.json') as json_file:
mock_json = json.load(json_file)

responses.add(
Expand All @@ -198,7 +213,7 @@ def test_get_modes_v2(self):
mocked_url = "https://my.arlo.com/hmsweb/users/devices/automation/active"
mock_json = {}

with open('./responses/expected_get_modes_v2_response.json') as json_file:
with open('./tests/responses/expected_get_modes_v2_response.json') as json_file:
mock_json = json.load(json_file)

responses.add(
Expand Down

0 comments on commit e1d62c9

Please sign in to comment.