pyemoncms 0.0.8__tar.gz → 0.0.9__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.
- {pyemoncms-0.0.8 → pyemoncms-0.0.9}/PKG-INFO +2 -3
- {pyemoncms-0.0.8 → pyemoncms-0.0.9}/README.md +1 -2
- {pyemoncms-0.0.8 → pyemoncms-0.0.9}/pyemoncms/emoncms_client.py +21 -11
- {pyemoncms-0.0.8 → pyemoncms-0.0.9}/pyemoncms.egg-info/PKG-INFO +2 -3
- {pyemoncms-0.0.8 → pyemoncms-0.0.9}/setup.py +1 -1
- {pyemoncms-0.0.8 → pyemoncms-0.0.9}/LICENSE +0 -0
- {pyemoncms-0.0.8 → pyemoncms-0.0.9}/pyemoncms/__init__.py +0 -0
- {pyemoncms-0.0.8 → pyemoncms-0.0.9}/pyemoncms.egg-info/SOURCES.txt +0 -0
- {pyemoncms-0.0.8 → pyemoncms-0.0.9}/pyemoncms.egg-info/dependency_links.txt +0 -0
- {pyemoncms-0.0.8 → pyemoncms-0.0.9}/pyemoncms.egg-info/requires.txt +0 -0
- {pyemoncms-0.0.8 → pyemoncms-0.0.9}/pyemoncms.egg-info/top_level.txt +0 -0
- {pyemoncms-0.0.8 → pyemoncms-0.0.9}/pyproject.toml +0 -0
- {pyemoncms-0.0.8 → pyemoncms-0.0.9}/setup.cfg +0 -0
- {pyemoncms-0.0.8 → pyemoncms-0.0.9}/tests/test_async_request.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyemoncms
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.9
|
|
4
4
|
Summary: A python library to interrogate emoncms API
|
|
5
5
|
Home-page: https://github.com/Open-Building-Management/pyemoncms
|
|
6
6
|
Author: Alexandre CUER
|
|
@@ -64,8 +64,7 @@ async def main():
|
|
|
64
64
|
"""fetches somes datas in emoncms"""
|
|
65
65
|
async with EmoncmsClient(url, key, request_timeout=1) as client:
|
|
66
66
|
client.logger.setLevel("DEBUG")
|
|
67
|
-
print(await client.
|
|
68
|
-
print(await client.async_request("/user/getuuid.json"))
|
|
67
|
+
print(await client.async_get_uuid())
|
|
69
68
|
print(await client.async_list_feeds())
|
|
70
69
|
print(await client.async_get_feed_fields(1))
|
|
71
70
|
|
|
@@ -48,8 +48,7 @@ async def main():
|
|
|
48
48
|
"""fetches somes datas in emoncms"""
|
|
49
49
|
async with EmoncmsClient(url, key, request_timeout=1) as client:
|
|
50
50
|
client.logger.setLevel("DEBUG")
|
|
51
|
-
print(await client.
|
|
52
|
-
print(await client.async_request("/user/getuuid.json"))
|
|
51
|
+
print(await client.async_get_uuid())
|
|
53
52
|
print(await client.async_list_feeds())
|
|
54
53
|
print(await client.async_get_feed_fields(1))
|
|
55
54
|
|
|
@@ -76,13 +76,6 @@ class EmoncmsClient:
|
|
|
76
76
|
data[SUCCESS_KEY] = True
|
|
77
77
|
json_response = await response.json()
|
|
78
78
|
data[MESSAGE_KEY] = json_response
|
|
79
|
-
if json_response is False:
|
|
80
|
-
data[SUCCESS_KEY] = False
|
|
81
|
-
elif SUCCESS_KEY in json_response:
|
|
82
|
-
data = json_response
|
|
83
|
-
if not data[SUCCESS_KEY]:
|
|
84
|
-
message = data[MESSAGE_KEY].replace("ADMIN", "EMONCMS ADMIN")
|
|
85
|
-
self.logger.warning(message)
|
|
86
79
|
else:
|
|
87
80
|
message = f"error {response.status}"
|
|
88
81
|
if response.status in HTTP_STATUS:
|
|
@@ -91,11 +84,28 @@ class EmoncmsClient:
|
|
|
91
84
|
self.logger.error(message)
|
|
92
85
|
return data
|
|
93
86
|
|
|
94
|
-
async def
|
|
95
|
-
"""
|
|
96
|
-
|
|
97
|
-
|
|
87
|
+
async def async_get_uuid(self) -> str | None:
|
|
88
|
+
"""Return the unique identifier or None.
|
|
89
|
+
|
|
90
|
+
drop a warning during migration process from a non uuid emoncms to a uuid one
|
|
91
|
+
|
|
92
|
+
this warns the user to do a database update
|
|
93
|
+
|
|
94
|
+
first uuid version of emoncms is 11.5.7
|
|
98
95
|
"""
|
|
96
|
+
result = await self.async_request('/user/getuuid.json')
|
|
97
|
+
if result[SUCCESS_KEY]:
|
|
98
|
+
json_response = result[MESSAGE_KEY]
|
|
99
|
+
if json_response is False:
|
|
100
|
+
return None
|
|
101
|
+
if json_response[SUCCESS_KEY]:
|
|
102
|
+
return json_response[MESSAGE_KEY]
|
|
103
|
+
message = json_response[MESSAGE_KEY].replace("ADMIN", "EMONCMS ADMIN")
|
|
104
|
+
self.logger.warning(message)
|
|
105
|
+
return None
|
|
106
|
+
|
|
107
|
+
async def async_list_feeds(self) -> list[dict[str, Any]] | None:
|
|
108
|
+
"""Request emoncms feeds list."""
|
|
99
109
|
feed_data = await self.async_request("/feed/list.json")
|
|
100
110
|
if feed_data[SUCCESS_KEY]:
|
|
101
111
|
return feed_data[MESSAGE_KEY]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyemoncms
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.9
|
|
4
4
|
Summary: A python library to interrogate emoncms API
|
|
5
5
|
Home-page: https://github.com/Open-Building-Management/pyemoncms
|
|
6
6
|
Author: Alexandre CUER
|
|
@@ -64,8 +64,7 @@ async def main():
|
|
|
64
64
|
"""fetches somes datas in emoncms"""
|
|
65
65
|
async with EmoncmsClient(url, key, request_timeout=1) as client:
|
|
66
66
|
client.logger.setLevel("DEBUG")
|
|
67
|
-
print(await client.
|
|
68
|
-
print(await client.async_request("/user/getuuid.json"))
|
|
67
|
+
print(await client.async_get_uuid())
|
|
69
68
|
print(await client.async_list_feeds())
|
|
70
69
|
print(await client.async_get_feed_fields(1))
|
|
71
70
|
|
|
@@ -6,7 +6,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
|
6
6
|
|
|
7
7
|
setuptools.setup(
|
|
8
8
|
name="pyemoncms",
|
|
9
|
-
version="0.0.
|
|
9
|
+
version="0.0.9",
|
|
10
10
|
author="Alexandre CUER",
|
|
11
11
|
author_email="alexandre.cuer@wanadoo.fr",
|
|
12
12
|
description="A python library to interrogate emoncms API",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|