Skip to content

Commit 28640fd

Browse files
authored
Merge pull request #105 from lostfields/bugfix/version-check
bugfix/Version check
2 parents 8ca861f + e5cff4e commit 28640fd

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

pcomfortcloud/authentication.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import time
88
import urllib
99
import requests
10+
import re
1011

1112
from bs4 import BeautifulSoup
1213
from . import exceptions
@@ -437,20 +438,19 @@ def _update_app_version(self):
437438
if self._raw:
438439
print("--- auto detecting latest app version")
439440
try:
440-
response = requests.get(constants.APPBRAIN_URL)
441-
responseContent = response.content
442-
soup = BeautifulSoup(responseContent, "html.parser")
443-
meta_tag = soup.find("meta", itemprop="softwareVersion")
444-
if meta_tag is not None:
445-
version = meta_tag['content']
441+
response = requests.get("https://play.google.com/store/apps/details?id=com.panasonic.ACCsmart")
442+
responseText = response.content.decode("utf-8")
443+
version_match = re.search(r'\[\"(\d+\.\d+\.\d+)\"\]', responseText)
444+
if version_match:
445+
version = version_match.group(1)
446446
self._app_version = version
447447
if self._raw:
448448
print("--- found version: {}".format(self._app_version))
449449
return
450450
else:
451451
self._app_version = constants.X_APP_VERSION
452452
if self._raw:
453-
print("--- Error finding meta_tag")
453+
print("--- error finding version")
454454
return
455455

456456
except Exception:

pcomfortcloud/constants.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
BASE_PATH_AUTH = "https://authglb.digital.panasonic.com"
77
BASE_PATH_ACC = "https://accsmart.panasonic.com"
88
X_APP_VERSION = "1.22.0"
9-
APPBRAIN_URL = "https://www.appbrain.com/app/panasonic-comfort-cloud/com.panasonic.ACCsmart"
109

1110
class Power(Enum):
1211
Off = 0

0 commit comments

Comments
 (0)