mezz64 / pyEight

Python library to interface with the Eight Sleep API
MIT License
59 stars 15 forks source link

More bug fixes #19

Closed raman325 closed 3 years ago

raman325 commented 3 years ago

So two more bug fixes, one that I introduced and should have caught but didn't test properly, and one that I noticed once I got this bug fixed:

  1. When a ClientSession was passed in externally, it did not have the DEFAULT_HEADERS and the api_post command doesn't add it to the request unlike api_put and api_get, so post requests would fail in that scenario. I've updated the logic so that for all requests, including posts, the headers get inserted into the request before making the request. To guard against problems fetching the token, we only add the session-token if we have one.
  2. I was getting IndexErrors on some of the user functions. I think this is because my cover is still relatively new and I have been having Wifi issues so not all the data is available yet. I think it's safe to catch the IndexErrors since you always have a way in each method to indicate that that property is not currently available.

I can't make the dependency bump in HA without fixing issue 1 because we really should be getting the client session from HA, but it appears things are working again with these changes.

I went ahead and bumped the versions, including the tarball, which I apologize for missing the last time.

mezz64 commented 3 years ago

Thanks!