ironflock 0.1.1__tar.gz → 1.0.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.
- {ironflock-0.1.1/ironflock.egg-info → ironflock-1.0.1}/PKG-INFO +7 -5
- {ironflock-0.1.1 → ironflock-1.0.1}/README.md +5 -3
- {ironflock-0.1.1 → ironflock-1.0.1}/ironflock/AutobahnConnection.py +14 -4
- {ironflock-0.1.1 → ironflock-1.0.1}/ironflock/ironflock.py +20 -18
- {ironflock-0.1.1 → ironflock-1.0.1/ironflock.egg-info}/PKG-INFO +7 -5
- ironflock-1.0.1/ironflock.egg-info/requires.txt +1 -0
- ironflock-1.0.1/requirements.txt +1 -0
- {ironflock-0.1.1 → ironflock-1.0.1}/setup.py +1 -1
- ironflock-0.1.1/ironflock.egg-info/requires.txt +0 -1
- ironflock-0.1.1/requirements.txt +0 -1
- {ironflock-0.1.1 → ironflock-1.0.1}/LICENSE +0 -0
- {ironflock-0.1.1 → ironflock-1.0.1}/MANIFEST.in +0 -0
- {ironflock-0.1.1 → ironflock-1.0.1}/ironflock/__init__.py +0 -0
- {ironflock-0.1.1 → ironflock-1.0.1}/ironflock.egg-info/SOURCES.txt +0 -0
- {ironflock-0.1.1 → ironflock-1.0.1}/ironflock.egg-info/dependency_links.txt +0 -0
- {ironflock-0.1.1 → ironflock-1.0.1}/ironflock.egg-info/top_level.txt +0 -0
- {ironflock-0.1.1 → ironflock-1.0.1}/pyproject.toml +0 -0
- {ironflock-0.1.1 → ironflock-1.0.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ironflock
|
|
3
|
-
Version: 0.1
|
|
3
|
+
Version: 1.0.1
|
|
4
4
|
Summary: Publishing data to a IronFlock Fleet Storage
|
|
5
5
|
Home-page: https://github.com/RecordEvolution/ironflock-python
|
|
6
6
|
Author: Record Evolution GmbH
|
|
@@ -9,16 +9,19 @@ License: MIT
|
|
|
9
9
|
Requires-Python: >=3.6
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
11
|
License-File: LICENSE
|
|
12
|
-
Requires-Dist: autobahn[asyncio,
|
|
12
|
+
Requires-Dist: autobahn[asyncio,serialization]==22.3.2
|
|
13
13
|
|
|
14
14
|
# ironflock
|
|
15
15
|
|
|
16
16
|
## About
|
|
17
17
|
|
|
18
|
-
With this library you can
|
|
18
|
+
With this library you can publish data from your apps on your IoT edge hardware to the fleet data storage of the [IronFlock](https://studio.ironflock.com) devops platform.
|
|
19
|
+
When this library is used on a certain device the library automatically uses the private messaging realm (Unified Name Space)
|
|
20
|
+
of the device's fleet and the data is collected in the respective fleet database.
|
|
19
21
|
|
|
20
22
|
So if you use the library in your app, the data collection will always be private to the app user's fleet.
|
|
21
23
|
|
|
24
|
+
For more information on the IronFlock IoT Devops Platform for engineers and developers visit our [IronFlock](https://www.ironflock.com) home page.
|
|
22
25
|
## Usage
|
|
23
26
|
|
|
24
27
|
```python
|
|
@@ -73,8 +76,7 @@ pip install --upgrade setuptools wheel twine
|
|
|
73
76
|
Build and publish a new pypi package:
|
|
74
77
|
|
|
75
78
|
```shell
|
|
76
|
-
|
|
77
|
-
twine upload dist/*
|
|
79
|
+
make publish
|
|
78
80
|
```
|
|
79
81
|
|
|
80
82
|
Check the package at https://pypi.org/project/ironflock/.
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## About
|
|
4
4
|
|
|
5
|
-
With this library you can
|
|
5
|
+
With this library you can publish data from your apps on your IoT edge hardware to the fleet data storage of the [IronFlock](https://studio.ironflock.com) devops platform.
|
|
6
|
+
When this library is used on a certain device the library automatically uses the private messaging realm (Unified Name Space)
|
|
7
|
+
of the device's fleet and the data is collected in the respective fleet database.
|
|
6
8
|
|
|
7
9
|
So if you use the library in your app, the data collection will always be private to the app user's fleet.
|
|
8
10
|
|
|
11
|
+
For more information on the IronFlock IoT Devops Platform for engineers and developers visit our [IronFlock](https://www.ironflock.com) home page.
|
|
9
12
|
## Usage
|
|
10
13
|
|
|
11
14
|
```python
|
|
@@ -60,8 +63,7 @@ pip install --upgrade setuptools wheel twine
|
|
|
60
63
|
Build and publish a new pypi package:
|
|
61
64
|
|
|
62
65
|
```shell
|
|
63
|
-
|
|
64
|
-
twine upload dist/*
|
|
66
|
+
make publish
|
|
65
67
|
```
|
|
66
68
|
|
|
67
69
|
Check the package at https://pypi.org/project/ironflock/.
|
|
@@ -9,8 +9,18 @@ try:
|
|
|
9
9
|
except:
|
|
10
10
|
raise Exception("Environment variable SWARM_KEY not set!")
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
try:
|
|
13
|
+
APP_KEY = os.environ["APP_KEY"]
|
|
14
|
+
except:
|
|
15
|
+
raise Exception("Environment variable APP_KEY not set!")
|
|
16
|
+
|
|
17
|
+
try:
|
|
18
|
+
ENV = os.environ["ENV"].lower()
|
|
19
|
+
except:
|
|
20
|
+
raise Exception("Environment variable ENV not set!")
|
|
21
|
+
|
|
22
|
+
# CB_REALM = "userapps"
|
|
23
|
+
CB_REALM = f"realm-{SWARM_KEY}-{APP_KEY}-{ENV}"
|
|
14
24
|
|
|
15
25
|
DATAPODS_WS_URI = "wss://cbw.datapods.io/ws-ua-usr"
|
|
16
26
|
STUDIO_WS_URI_OLD = "wss://cbw.record-evolution.com/ws-ua-usr"
|
|
@@ -69,7 +79,7 @@ class AppSession(ApplicationSession):
|
|
|
69
79
|
def create_application_session(
|
|
70
80
|
serial_number: str = None,
|
|
71
81
|
) -> Tuple[ApplicationSession, ApplicationRunner]:
|
|
72
|
-
"""Creates an Autobahn ApplicationSession and ApplicationRunner, which connects to the
|
|
82
|
+
"""Creates an Autobahn ApplicationSession and ApplicationRunner, which connects to the IronFlock Platform
|
|
73
83
|
|
|
74
84
|
Args:
|
|
75
85
|
serial_number (str, optional): serial_number of device.
|
|
@@ -91,7 +101,7 @@ def create_application_session(
|
|
|
91
101
|
|
|
92
102
|
|
|
93
103
|
def create_application_component(serial_number: str = None) -> Component:
|
|
94
|
-
"""Creates an Autobahn Component, which connects to the
|
|
104
|
+
"""Creates an Autobahn Component, which connects to the IronFlock Platform
|
|
95
105
|
|
|
96
106
|
Args:
|
|
97
107
|
serial_number (str, optional): serial_number of device.
|
|
@@ -9,22 +9,22 @@ from ironflock.AutobahnConnection import getSerialNumber, create_application_com
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class IronFlock:
|
|
12
|
-
"""
|
|
12
|
+
"""Conveniance class for easy-to-use message publishing in the IronFlock platform.
|
|
13
13
|
|
|
14
14
|
Example:
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
ironFlock = IronFlock()
|
|
17
17
|
|
|
18
18
|
async def main():
|
|
19
19
|
while True:
|
|
20
|
-
publication = await
|
|
20
|
+
publication = await ironFlock.publish("test.publish.pw", 1, "two", 3, foo="bar")
|
|
21
21
|
print(publication)
|
|
22
22
|
await asyncio.sleep(3)
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
if __name__ == "__main__":
|
|
26
26
|
asyncio.get_event_loop().create_task(main())
|
|
27
|
-
|
|
27
|
+
ironFlock.run()
|
|
28
28
|
"""
|
|
29
29
|
|
|
30
30
|
def __init__(self, serial_number: str = None, mainFunc=None) -> None:
|
|
@@ -36,6 +36,7 @@ class IronFlock:
|
|
|
36
36
|
"""
|
|
37
37
|
self._serial_number = getSerialNumber(serial_number)
|
|
38
38
|
self._device_name = os.environ.get("DEVICE_NAME")
|
|
39
|
+
self._device_key = os.environ.get("DEVICE_KEY")
|
|
39
40
|
self._component = create_application_component(serial_number)
|
|
40
41
|
self._session: ISession = None
|
|
41
42
|
self.mainFunc = mainFunc
|
|
@@ -45,7 +46,7 @@ class IronFlock:
|
|
|
45
46
|
print("component joined")
|
|
46
47
|
self._session = session
|
|
47
48
|
if self.mainFunc:
|
|
48
|
-
await self.mainFunc(
|
|
49
|
+
await self.mainFunc()
|
|
49
50
|
|
|
50
51
|
@self._component.on_disconnect
|
|
51
52
|
def onDisconnect(*args, **kwargs):
|
|
@@ -76,7 +77,7 @@ class IronFlock:
|
|
|
76
77
|
return self._session
|
|
77
78
|
|
|
78
79
|
async def publish(self, topic: str, *args, **kwargs) -> Optional[Publication]:
|
|
79
|
-
"""Publishes to the
|
|
80
|
+
"""Publishes to the IronFlock Platform Message Router
|
|
80
81
|
|
|
81
82
|
Args:
|
|
82
83
|
topic (str): The URI of the topic to publish to, e.g. "com.myapp.mytopic1"
|
|
@@ -88,6 +89,7 @@ class IronFlock:
|
|
|
88
89
|
|
|
89
90
|
extra = {
|
|
90
91
|
"DEVICE_SERIAL_NUMBER": self._serial_number,
|
|
92
|
+
"DEVICE_KEY": self._device_key,
|
|
91
93
|
"DEVICE_NAME": self._device_name,
|
|
92
94
|
"options": PublishOptions(acknowledge=True),
|
|
93
95
|
}
|
|
@@ -102,6 +104,8 @@ class IronFlock:
|
|
|
102
104
|
"""Update the location of the device registered in the platform
|
|
103
105
|
This will update the device's location in the master data of the platform.
|
|
104
106
|
The maps in the device or group overviews will reflect the new device location in realtime.
|
|
107
|
+
The location history will not be stored in the platform.
|
|
108
|
+
If you need location history, then create a dedicated table for it.
|
|
105
109
|
"""
|
|
106
110
|
|
|
107
111
|
payload = {
|
|
@@ -111,6 +115,7 @@ class IronFlock:
|
|
|
111
115
|
|
|
112
116
|
extra = {
|
|
113
117
|
"DEVICE_SERIAL_NUMBER": self._serial_number,
|
|
118
|
+
"DEVICE_KEY": self._device_key,
|
|
114
119
|
"DEVICE_NAME": self._device_name
|
|
115
120
|
}
|
|
116
121
|
|
|
@@ -121,8 +126,14 @@ class IronFlock:
|
|
|
121
126
|
async def publish_to_table(
|
|
122
127
|
self, tablename: str, *args, **kwargs
|
|
123
128
|
) -> Optional[Publication]:
|
|
124
|
-
"""Publishes Data to a Table in the
|
|
125
|
-
|
|
129
|
+
"""Publishes Data to a Table in the IronFlock Platform. This is a conveniance function.
|
|
130
|
+
You can achieve the same results by simply publishing a payload to the topic
|
|
131
|
+
|
|
132
|
+
[SWARM_KEY].[APP_KEY].[your_table_name]
|
|
133
|
+
|
|
134
|
+
The SWARM_KEY and APP_KEY are provided as environment variables to the device container.
|
|
135
|
+
The also provided ENV variable holds either PROD or DEV to decide which topic to use, above.
|
|
136
|
+
This function automatically detects the environment and publishes to the correct table.
|
|
126
137
|
Args:
|
|
127
138
|
tablename (str): The table name of the table to publish to, e.g. "sensordata"
|
|
128
139
|
|
|
@@ -144,16 +155,7 @@ class IronFlock:
|
|
|
144
155
|
if app_key is None:
|
|
145
156
|
raise Exception("Environment variable APP_KEY not set!")
|
|
146
157
|
|
|
147
|
-
|
|
148
|
-
raise Exception("Environment variable ENV not set!")
|
|
149
|
-
|
|
150
|
-
if not env_value in ["DEV", "PROD"]:
|
|
151
|
-
raise Exception("Environment variable ENV must be 'PROD' or 'DEV'!")
|
|
152
|
-
|
|
153
|
-
if env_value == "PROD":
|
|
154
|
-
topic = f"{swarm_key}.{app_key}.{tablename}"
|
|
155
|
-
else:
|
|
156
|
-
topic = f"dev.{swarm_key}.{app_key}.{tablename}"
|
|
158
|
+
topic = f"{swarm_key}.{app_key}.{tablename}"
|
|
157
159
|
|
|
158
160
|
pub = await self.publish(topic, *args, **kwargs)
|
|
159
161
|
return pub
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ironflock
|
|
3
|
-
Version: 0.1
|
|
3
|
+
Version: 1.0.1
|
|
4
4
|
Summary: Publishing data to a IronFlock Fleet Storage
|
|
5
5
|
Home-page: https://github.com/RecordEvolution/ironflock-python
|
|
6
6
|
Author: Record Evolution GmbH
|
|
@@ -9,16 +9,19 @@ License: MIT
|
|
|
9
9
|
Requires-Python: >=3.6
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
11
|
License-File: LICENSE
|
|
12
|
-
Requires-Dist: autobahn[asyncio,
|
|
12
|
+
Requires-Dist: autobahn[asyncio,serialization]==22.3.2
|
|
13
13
|
|
|
14
14
|
# ironflock
|
|
15
15
|
|
|
16
16
|
## About
|
|
17
17
|
|
|
18
|
-
With this library you can
|
|
18
|
+
With this library you can publish data from your apps on your IoT edge hardware to the fleet data storage of the [IronFlock](https://studio.ironflock.com) devops platform.
|
|
19
|
+
When this library is used on a certain device the library automatically uses the private messaging realm (Unified Name Space)
|
|
20
|
+
of the device's fleet and the data is collected in the respective fleet database.
|
|
19
21
|
|
|
20
22
|
So if you use the library in your app, the data collection will always be private to the app user's fleet.
|
|
21
23
|
|
|
24
|
+
For more information on the IronFlock IoT Devops Platform for engineers and developers visit our [IronFlock](https://www.ironflock.com) home page.
|
|
22
25
|
## Usage
|
|
23
26
|
|
|
24
27
|
```python
|
|
@@ -73,8 +76,7 @@ pip install --upgrade setuptools wheel twine
|
|
|
73
76
|
Build and publish a new pypi package:
|
|
74
77
|
|
|
75
78
|
```shell
|
|
76
|
-
|
|
77
|
-
twine upload dist/*
|
|
79
|
+
make publish
|
|
78
80
|
```
|
|
79
81
|
|
|
80
82
|
Check the package at https://pypi.org/project/ironflock/.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
autobahn[asyncio,serialization]==22.3.2
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
autobahn[asyncio, serialization]==22.3.2
|
|
@@ -10,7 +10,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
|
10
10
|
|
|
11
11
|
setup(
|
|
12
12
|
name="ironflock",
|
|
13
|
-
version="0.1
|
|
13
|
+
version="1.0.1",
|
|
14
14
|
description="Publishing data to a IronFlock Fleet Storage",
|
|
15
15
|
long_description=long_description,
|
|
16
16
|
long_description_content_type="text/markdown",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
autobahn[asyncio,compression,serialization]==22.3.2
|
ironflock-0.1.1/requirements.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
autobahn[asyncio, serialization, compression]==22.3.2
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|