Skip to content

Commit

Permalink
Merge pull request #105 from lostfields/bugfix/version-check
Browse files Browse the repository at this point in the history
bugfix/Version check
  • Loading branch information
lostfields authored Nov 9, 2024
2 parents 8ca861f + e5cff4e commit 28640fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
14 changes: 7 additions & 7 deletions pcomfortcloud/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import time
import urllib
import requests
import re

from bs4 import BeautifulSoup
from . import exceptions
Expand Down Expand Up @@ -437,20 +438,19 @@ def _update_app_version(self):
if self._raw:
print("--- auto detecting latest app version")
try:
response = requests.get(constants.APPBRAIN_URL)
responseContent = response.content
soup = BeautifulSoup(responseContent, "html.parser")
meta_tag = soup.find("meta", itemprop="softwareVersion")
if meta_tag is not None:
version = meta_tag['content']
response = requests.get("https://play.google.com/store/apps/details?id=com.panasonic.ACCsmart")
responseText = response.content.decode("utf-8")
version_match = re.search(r'\[\"(\d+\.\d+\.\d+)\"\]', responseText)
if version_match:
version = version_match.group(1)
self._app_version = version
if self._raw:
print("--- found version: {}".format(self._app_version))
return
else:
self._app_version = constants.X_APP_VERSION
if self._raw:
print("--- Error finding meta_tag")
print("--- error finding version")
return

except Exception:
Expand Down
1 change: 0 additions & 1 deletion pcomfortcloud/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
BASE_PATH_AUTH = "https://authglb.digital.panasonic.com"
BASE_PATH_ACC = "https://accsmart.panasonic.com"
X_APP_VERSION = "1.22.0"
APPBRAIN_URL = "https://www.appbrain.com/app/panasonic-comfort-cloud/com.panasonic.ACCsmart"

class Power(Enum):
Off = 0
Expand Down

0 comments on commit 28640fd

Please sign in to comment.