Skip to content

Commit

Permalink
Potential fix for 216 Unauthorized error
Browse files Browse the repository at this point in the history
  • Loading branch information
FlyingDiver committed Nov 28, 2017
1 parent 7de7a75 commit 2602e84
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion MyQ.indigoPlugin/Contents/Info.plist
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>PluginVersion</key>
<string>7.1.8</string>
<string>7.1.9</string>
<key>ServerApiVersion</key>
<string>2.0</string>
<key>IwsApiVersion</key>
Expand Down
13 changes: 10 additions & 3 deletions MyQ.indigoPlugin/Contents/Server Plugin/plugin.py
Expand Up @@ -335,7 +335,7 @@ def myqLogin(self, username=None, password=None, brand=None):
return False

if (response.status_code != requests.codes.ok):
self.logger.debug(u"myqLogin failure, Enum err code %s" % (response.status_coderl))
self.logger.debug(u"myqLogin failure, Enum err code %s" % (response.status_code))
self.securityToken = ""
return False

Expand Down Expand Up @@ -367,8 +367,15 @@ def getDevices(self):
return

url = self.apiData[brand]["service"] + '/api/v4/UserDeviceDetails/Get'
params = {'appId':self.apiData[brand]["appID"], 'securityToken':self.securityToken}
headers = {'User-Agent': userAgent }
params = {
'appId':self.apiData[brand]["appID"],
'securityToken':self.securityToken
}
headers = {
'SecurityToken': self.securityToken,
'MyQApplicationId': self.apiData[brand]["appID"],
'User-Agent': userAgent
}
try:
response = requests.get(url, params=params, headers=headers)
except requests.exceptions.RequestException as err:
Expand Down

0 comments on commit 2602e84

Please sign in to comment.