Skip to content

Commit

Permalink
Change User-Agent to pymyq (#54)
Browse files Browse the repository at this point in the history
* Fix UnboundLocalError in API._send_request

Addresses a symptom of #53

* Change User-Agent to pymyq

Chamberlain is blocking the User-Agent "okhttp/3.10.0"

Root cause of #53
  • Loading branch information
hstern committed Dec 17, 2020
1 parent 01047e3 commit 4f2504e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pymyq/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
API_BASE = "https://api.myqdevice.com/api/v{0}"

DEFAULT_APP_ID = "JVM/G9Nwih5BwKgNCjLxiFUQxQijAebyyg8QUHr7JOrP+tuPb8iHfRHKwTmDzHOu"
DEFAULT_USER_AGENT = "okhttp/3.10.0"
DEFAULT_USER_AGENT = 'pymyq'
DEFAULT_BRAND_ID = 2
DEFAULT_REQUEST_RETRIES = 5
DEFAULT_CULTURE = "en"
Expand Down Expand Up @@ -92,6 +92,7 @@ async def _send_request(
return data
except ClientError as err:
_LOGGER.debug(f"Attempt {attempt} request failed with exception: {str(err)}")
message = f"Error requesting data from {url}: {data.get('description', str(err))}"
if hasattr(err, "status") and err.status == 401:
if login_request:
self._credentials = {}
Expand All @@ -111,7 +112,6 @@ async def _send_request(
attempt = 0
continue

message = f"Error requesting data from {url}: {data.get('description', str(err))}"
_LOGGER.error(message)
raise RequestError(message)

Expand Down

0 comments on commit 4f2504e

Please sign in to comment.