Skip to content

Commit

Permalink
Merge pull request #30 from BigManDave/main
Browse files Browse the repository at this point in the history
ISSUE 28 - Add User-Agent header
  • Loading branch information
macxq authored Jan 15, 2022
2 parents ec19875 + fb8d8a0 commit 28a49d2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions custom_components/foxess/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async def async_update_data():
allData = {}
token = await authAndgetToken(hass, username, hashedPassword)
headersData = {"token": token}
headersData = {"token": token, "User-Agent": "Chrome"}

await getErnings(hass, headersData, allData, deviceID)
await getAddresbook(hass, headersData, allData, deviceID)
Expand Down Expand Up @@ -139,7 +139,7 @@ async def authAndgetToken(hass, username, hashedPassword):

payloadAuth = {"user": username, "password": hashedPassword}
headersAuth = {"Content-Type": "application/json;charset=UTF-8",
"Accept": "application/json, text/plain, */*", "lang": "en"}
"Accept": "application/json, text/plain, */*", "lang": "en", "User-Agent": "Chrome"}

restAuth = RestData(hass, METHOD_POST, _ENDPOINT_AUTH, None,
headersAuth, None, payloadAuth, DEFAULT_VERIFY_SSL)
Expand Down

0 comments on commit 28a49d2

Please sign in to comment.