Skip to content

Commit

Permalink
Merge pull request #22 from JanJaapKo/addHttpHeaders
Browse files Browse the repository at this point in the history
Add HTTPHeaders to calls t oDyson cloud account
  • Loading branch information
JanJaapKo authored Aug 28, 2020
2 parents 85dfa4b + 9059a46 commit ecaa289
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions dyson.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def login(self):
uri = "https://{0}/v1/userregistration/authenticate?country={1}".format(DYSON_API_URL, self._country)
Domoticz.Debug("Request URL: '" + uri + "'")
login = requests.post(
uri, request_body, verify=False)
uri, request_body, verify=False, headers={'User-Agent': 'Mozilla/5.0'})
if login.status_code == requests.codes.ok:
json_response = login.json()
Domoticz.Debug("Login OK, JSON response: '"+str(json_response)+"'")
Expand All @@ -50,7 +50,7 @@ def devices(self):
Domoticz.Debug("Fetching devices from Dyson Web Services.")
device_response = requests.get(
"https://{0}/v1/provisioningservice/manifest".format(
DYSON_API_URL), verify=False, auth=self._auth)
DYSON_API_URL), verify=False, auth=self._auth, headers={'User-Agent': 'Mozilla/5.0'})
devices_dict = {}
Domoticz.Debug("Reply from Dyson: "+str(device_response.json())+"'")
for device in device_response.json():
Expand Down
2 changes: 1 addition & 1 deletion plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def onStart(self):

#create a Dyson account
Domoticz.Debug("=== start making connection to Dyson account ===")
dysonAccount = DysonAccount(Parameters['Mode5'], Parameters['Mode3'], "FR")
dysonAccount = DysonAccount(Parameters['Mode5'], Parameters['Mode3'], "NL")
dysonAccount.login()
#deviceList = ()
deviceList = []
Expand Down

0 comments on commit ecaa289

Please sign in to comment.