fyta-cli 0.1__tar.gz → 0.2__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,9 +1,15 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fyta_cli
3
- Version: 0.1
3
+ Version: 0.2
4
4
  Summary: Python library to access the FYTA API
5
+ Project-URL: Repository, https://github.com/dontinelli/fyta_cli.git
6
+ Project-URL: Issues, https://github.com/dontinelli/fyta_cli/issues
7
+ Project-URL: Changelog, https://github.com/dontinelli/fyta_cly/blob/master/CHANGELOG.md
8
+ Project-URL: FYTA homepage, https://fyta.de/
9
+ Project-URL: API Documentation, https://fyta-io.notion.site/FYTA-Public-API-d2f4c30306f74504924c9a40402a3afd
5
10
  Author-email: dontinelli <73341522+dontinelli@users.noreply.github.com>
6
11
  License-File: LICENSE
12
+ Keywords: IoT,fyta,hass,home assistant,plant,sensor,smart home
7
13
  Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
8
14
  Classifier: Operating System :: OS Independent
9
15
  Classifier: Programming Language :: Python :: 3
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fyta_cli"
3
- version = "0.1"
3
+ version = "0.2"
4
4
  authors = [
5
5
  { name="dontinelli", email="73341522+dontinelli@users.noreply.github.com" },
6
6
  ]
@@ -20,6 +20,7 @@ classifiers = [
20
20
  "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
21
21
  "Operating System :: OS Independent",
22
22
  ]
23
+ keywords = ["plant", "sensor", "IoT", "smart home", "fyta", "hass", "home assistant"]
23
24
 
24
25
  [build-system]
25
26
  requires = ["hatchling"]
@@ -27,3 +28,10 @@ build-backend = "hatchling.build"
27
28
 
28
29
  [tool.hatch.build.targets.wheel]
29
30
  packages = ["src/fyta_cli"]
31
+
32
+ [project.urls]
33
+ Repository = "https://github.com/dontinelli/fyta_cli.git"
34
+ Issues = "https://github.com/dontinelli/fyta_cli/issues"
35
+ Changelog = "https://github.com/dontinelli/fyta_cly/blob/master/CHANGELOG.md"
36
+ "FYTA homepage" = "https://fyta.de/"
37
+ "API Documentation" = "https://fyta-io.notion.site/FYTA-Public-API-d2f4c30306f74504924c9a40402a3afd"
@@ -12,16 +12,16 @@ import asyncio
12
12
  from aiohttp import BasicAuth, ClientSession
13
13
  from dataclasses import dataclass, field
14
14
 
15
- from .exceptions import (
16
- HomeassistantFytaError,
17
- HomeassistantFytaConnectionError,
18
- HomeassistantFytaAuthentificationError,
19
- HomeassistantFytaPasswordError,
20
- HomeassistantFytaPlantError,
15
+ from fyta_exceptions import (
16
+ FytaError,
17
+ FytaConnectionError,
18
+ FytaAuthentificationError,
19
+ FytaPasswordError,
20
+ FytaPlantError,
21
21
  )
22
22
 
23
- FYTA_AUTH_URL = 'http://web.fyta.de/api/auth/login'
24
- FYTA_PLANT_URL = 'http://web.fyta.de/api/user-plant'
23
+ FYTA_AUTH_URL = 'https://web.fyta.de/api/auth/login'
24
+ FYTA_PLANT_URL = 'https://web.fyta.de/api/user-plant'
25
25
 
26
26
  _LOGGER = logging.getLogger(__name__)
27
27
 
@@ -73,7 +73,7 @@ class Client(object):
73
73
  except asyncio.TimeoutError as exception:
74
74
  _LOGGER.exception("timeout error")
75
75
  msg = "Timeout occurred while connecting to Fyta-server"
76
- raise HomeassistantFytaConnectionError(msg) from exception
76
+ raise FytaConnectionError(msg) from exception
77
77
 
78
78
  #content_type = response.headers.get("Content-Type", "")
79
79
 
@@ -81,9 +81,9 @@ class Client(object):
81
81
 
82
82
  if json_response == '{"statusCode":404,"error":"Not Found"}':
83
83
  _LOGGER.exception("Authentication failed")
84
- raise HomeassistantFytaAuthentificationError
84
+ raise FytaAuthentificationError
85
85
  elif json_response == '{"statusCode":401,"error":"Unauthorized","errors":[{"message":"Could not authenticate user"}]}':
86
- raise HomeassistantFytaPasswordError
86
+ raise FytaPasswordError
87
87
 
88
88
  self.access_token = json_response["access_token"]
89
89
  self.refresh_token = json_response["refresh_token"]
@@ -111,13 +111,13 @@ class Client(object):
111
111
  response = await self.session.get(url=FYTA_PLANT_URL, headers = header)
112
112
  except asyncio.TimeoutError as exception:
113
113
  msg = "Timeout occurred while connecting to Fyta-server"
114
- raise HomeassistantFytaConnectionError(msg) from exception
114
+ raise FytaConnectionError(msg) from exception
115
115
 
116
116
  content_type = response.headers.get("Content-Type", "")
117
117
 
118
118
  if content_type.count("text/html") > 0:
119
119
  text = await response.text()
120
- raise HomeassistantFytaPlantError(
120
+ raise FytaPlantError(
121
121
  msg,
122
122
  {"Content-Type": content_type, "response": text},
123
123
  )
@@ -156,13 +156,13 @@ class Client(object):
156
156
  response = await self.session.get(url=url, headers = header)
157
157
  except asyncio.TimeoutError as exception:
158
158
  msg = "Timeout occurred while connecting to Fyta-server"
159
- raise HomeassistantFytaConnectionError(msg) from exception
159
+ raise FytaConnectionError(msg) from exception
160
160
 
161
161
  content_type = response.headers.get("Content-Type", "")
162
162
 
163
163
  if content_type.count("text/html") > 0:
164
164
  text = await response.text()
165
- raise HomeassistantFytaPlantError(
165
+ raise FytaPlantError(
166
166
  msg,
167
167
  {"Content-Type": content_type, "response": text},
168
168
  )
@@ -3,7 +3,7 @@
3
3
  from datetime import datetime
4
4
  import pytz
5
5
 
6
- from .client import Client
6
+ from fyta_client import Client
7
7
 
8
8
  PLANT_STATUS = {
9
9
  1: "too low",
@@ -0,0 +1,18 @@
1
+ """Asynchronous Python client for FYTA."""
2
+
3
+
4
+ class FytaError(Exception):
5
+ """Generic exception."""
6
+
7
+
8
+ class FytaConnectionError(FytaError):
9
+ """Analytics connection exception."""
10
+
11
+ class FytaAuthentificationError(FytaError):
12
+ """Fyta Password exception (wrong password)."""
13
+
14
+ class FytaPasswordError(FytaError):
15
+ """Fyta Password exception (wrong password)."""
16
+
17
+ class FytaPlantError(FytaError):
18
+ """Fyta exception in getting plants."""
@@ -1,18 +0,0 @@
1
- """Asynchronous Python client for FYTA."""
2
-
3
-
4
- class HomeassistantFytaError(Exception):
5
- """Generic exception."""
6
-
7
-
8
- class HomeassistantFytaConnectionError(HomeassistantFytaError):
9
- """Homeassistant Analytics connection exception."""
10
-
11
- class HomeassistantFytaAuthentificationError(HomeassistantFytaError):
12
- """Homeassistant Fyta Password exception (wrong password)."""
13
-
14
- class HomeassistantFytaPasswordError(HomeassistantFytaError):
15
- """Homeassistant Fyta Password exception (wrong password)."""
16
-
17
- class HomeassistantFytaPlantError(HomeassistantFytaError):
18
- """Homeassistant Fyta exception in getting plants."""
File without changes
File without changes
File without changes