fyta-cli 0.2__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fyta_cli
3
- Version: 0.2
3
+ Version: 0.2.1
4
4
  Summary: Python library to access the FYTA API
5
5
  Project-URL: Repository, https://github.com/dontinelli/fyta_cli.git
6
6
  Project-URL: Issues, https://github.com/dontinelli/fyta_cli/issues
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fyta_cli"
3
- version = "0.2"
3
+ version = "0.2.1"
4
4
  authors = [
5
5
  { name="dontinelli", email="73341522+dontinelli@users.noreply.github.com" },
6
6
  ]
@@ -12,7 +12,7 @@ import asyncio
12
12
  from aiohttp import BasicAuth, ClientSession
13
13
  from dataclasses import dataclass, field
14
14
 
15
- from fyta_exceptions import (
15
+ from .fyta_exceptions import (
16
16
  FytaError,
17
17
  FytaConnectionError,
18
18
  FytaAuthentificationError,
@@ -75,14 +75,12 @@ class Client(object):
75
75
  msg = "Timeout occurred while connecting to Fyta-server"
76
76
  raise FytaConnectionError(msg) from exception
77
77
 
78
- #content_type = response.headers.get("Content-Type", "")
79
-
80
78
  json_response = await response.json()
81
79
 
82
- if json_response == '{"statusCode":404,"error":"Not Found"}':
80
+ if json_response == {"statusCode":404,"error":"Not Found"}:
83
81
  _LOGGER.exception("Authentication failed")
84
82
  raise FytaAuthentificationError
85
- elif json_response == '{"statusCode":401,"error":"Unauthorized","errors":[{"message":"Could not authenticate user"}]}':
83
+ elif json_response == {"statusCode":401,"error":"Unauthorized","errors":[{"message":"Could not authenticate user"}]}:
86
84
  raise FytaPasswordError
87
85
 
88
86
  self.access_token = json_response["access_token"]
@@ -3,7 +3,7 @@
3
3
  from datetime import datetime
4
4
  import pytz
5
5
 
6
- from fyta_client import Client
6
+ from .fyta_client import Client
7
7
 
8
8
  PLANT_STATUS = {
9
9
  1: "too low",
@@ -29,7 +29,7 @@ class FytaConnector(object):
29
29
  return await self.client.test_connection()
30
30
 
31
31
 
32
- async def login(self) -> bool:
32
+ async def login(self) -> dict:
33
33
  login = await self.client.login()
34
34
  self.access_token = login["access_token"]
35
35
  self.expiration = login["expiration"]
@@ -38,7 +38,7 @@ class FytaConnector(object):
38
38
  return login
39
39
 
40
40
 
41
- async def update_data(self):
41
+ async def update_plant_list(self):
42
42
  self.plant_list = await self.client.get_plants()
43
43
 
44
44
  return self.plant_list
@@ -47,7 +47,7 @@ class FytaConnector(object):
47
47
  async def update_all_plants(self):
48
48
  plants = {}
49
49
 
50
- plant_list = await self.update_data()
50
+ plant_list = await self.update_plant_list()
51
51
 
52
52
  for plant in plant_list.keys():
53
53
  current_plant = await self.update_plant_data(plant)
File without changes
File without changes