Skip to content

Commit 3ceef25

Browse files
v3.1.0 (#116)
* Creation of Account class and putting devices for the account within that account class * Account class * Change account_id to id * Updated due to account_id to id change * Update README for new MyQAccount class * Moved logic of device update into MyQDevice class * Fix for sending commands * Updating devices failed * Fix authentication by re-adding User Agent logic (#85) * Update development requirements * Fix development requirements * Create requirements_test * Add pytest-cov * Add pytest-timeout * Fix User Agent issue again * Update version * Changed logger items back to lazy % formatting * Move useragent into Request and pre-commit fixes * pre-commit fixes * pre-commit fixes * Updated example to use account object * More pre-commit * Empty out user agent * If .USERAGENT file is empty then don't set it in header * Add unknown devices * Fixed race condition when opening/closing in rapid fashion. * Update to v3.1.0b6 * Changed back to no intermediate state * Only need to lock once we send, not before * Set version to 3.1.0 * Bump isort from 5.7.0 to 5.9.3 (#114) Bumps [isort](https://github.com/pycqa/isort) from 5.7.0 to 5.9.3. - [Release notes](https://github.com/pycqa/isort/releases) - [Changelog](https://github.com/PyCQA/isort/blob/main/CHANGELOG.md) - [Commits](PyCQA/isort@5.7.0...5.9.3) --- updated-dependencies: - dependency-name: isort dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pre-commit from 2.10.1 to 2.14.0 (#115) Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 2.10.1 to 2.14.0. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/master/CHANGELOG.md) - [Commits](pre-commit/pre-commit@v2.10.1...v2.14.0) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump black from 20.8b1 to 21.7b0 (#113) Bumps [black](https://github.com/psf/black) from 20.8b1 to 21.7b0. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](https://github.com/psf/black/commits) --- updated-dependencies: - dependency-name: black dependency-type: direct:development ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 652e60d commit 3ceef25

File tree

3 files changed

+10
-22
lines changed

3 files changed

+10
-22
lines changed

pymyq/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"""Define a version constant."""
2-
__version__ = "3.1.1"
2+
__version__ = "3.1.0"

pymyq/api.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -578,12 +578,7 @@ async def update_device_info(self) -> None:
578578
self.last_state_update = datetime.utcnow()
579579

580580

581-
async def login(
582-
username: str,
583-
password: str,
584-
websession: ClientSession = None,
585-
auth_only: bool = False,
586-
) -> API:
581+
async def login(username: str, password: str, websession: ClientSession = None) -> API:
587582
"""Log in to the API."""
588583

589584
# Set the user agent in the headers.
@@ -598,9 +593,8 @@ async def login(
598593
_LOGGER.error("Authentication failed: %s", str(err))
599594
raise err
600595

601-
if not auth_only:
602-
# Retrieve and store initial set of devices:
603-
_LOGGER.debug("Retrieving MyQ information")
604-
await api.update_device_info()
596+
# Retrieve and store initial set of devices:
597+
_LOGGER.debug("Retrieving MyQ information")
598+
await api.update_device_info()
605599

606600
return api

pymyq/request.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ async def _send_request(
112112
last_error = ""
113113

114114
for attempt in range(DEFAULT_REQUEST_RETRIES):
115+
if self._useragent is None:
116+
await self._get_useragent()
115117
if self._useragent is not None and self._useragent != "":
116118
headers.update({"User-Agent": self._useragent})
117119

@@ -171,17 +173,9 @@ async def _send_request(
171173
await self._get_useragent()
172174

173175
except ClientError as err:
174-
if err.errno == 54 and attempt == 0:
175-
_LOGGER.debug(
176-
"Received error status 54, connection reset. Will refresh user agent."
177-
)
178-
await self._get_useragent()
179-
else:
180-
_LOGGER.debug(
181-
"Attempt %s request failed with exception: %s",
182-
attempt,
183-
str(err),
184-
)
176+
_LOGGER.debug(
177+
"Attempt %s request failed with exception: %s", attempt, str(err)
178+
)
185179
last_status = ""
186180
last_error = str(err)
187181
resp_exc = err

0 commit comments

Comments
 (0)