ironflock 1.0.2__tar.gz → 1.0.4__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-1.0.2/ironflock.egg-info → ironflock-1.0.4}/PKG-INFO +17 -33
- {ironflock-1.0.2 → ironflock-1.0.4}/README.md +1 -1
- {ironflock-1.0.2 → ironflock-1.0.4}/ironflock/__init__.py +1 -1
- {ironflock-1.0.2 → ironflock-1.0.4}/ironflock/ironflock.py +31 -9
- {ironflock-1.0.2 → ironflock-1.0.4/ironflock.egg-info}/PKG-INFO +17 -33
- ironflock-1.0.4/pyproject.toml +6 -0
- {ironflock-1.0.2 → ironflock-1.0.4}/setup.py +4 -4
- ironflock-1.0.2/pyproject.toml +0 -30
- {ironflock-1.0.2 → ironflock-1.0.4}/LICENSE +0 -0
- {ironflock-1.0.2 → ironflock-1.0.4}/MANIFEST.in +0 -0
- {ironflock-1.0.2 → ironflock-1.0.4}/ironflock/AutobahnConnection.py +0 -0
- {ironflock-1.0.2 → ironflock-1.0.4}/ironflock.egg-info/SOURCES.txt +0 -0
- {ironflock-1.0.2 → ironflock-1.0.4}/ironflock.egg-info/dependency_links.txt +0 -0
- {ironflock-1.0.2 → ironflock-1.0.4}/ironflock.egg-info/requires.txt +0 -0
- {ironflock-1.0.2 → ironflock-1.0.4}/ironflock.egg-info/top_level.txt +0 -0
- {ironflock-1.0.2 → ironflock-1.0.4}/requirements.txt +0 -0
- {ironflock-1.0.2 → ironflock-1.0.4}/setup.cfg +0 -0
|
@@ -1,41 +1,25 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: ironflock
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.4
|
|
4
4
|
Summary: SDK to integrate your IronFlock Industry 4 Apps with the IronFlock Data Infrastructure
|
|
5
|
-
Home-page: https://github.com/RecordEvolution/ironflock-
|
|
5
|
+
Home-page: https://github.com/RecordEvolution/ironflock-py
|
|
6
6
|
Author: Record Evolution GmbH
|
|
7
|
-
Author-email:
|
|
8
|
-
License: MIT
|
|
9
|
-
|
|
10
|
-
Copyright (c) 2021 Record Evolution
|
|
11
|
-
|
|
12
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
-
in the Software without restriction, including without limitation the rights
|
|
15
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
-
furnished to do so, subject to the following conditions:
|
|
18
|
-
|
|
19
|
-
The above copyright notice and this permission notice shall be included in all
|
|
20
|
-
copies or substantial portions of the Software.
|
|
21
|
-
|
|
22
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
-
SOFTWARE.
|
|
29
|
-
|
|
30
|
-
Project-URL: Homepage, https://github.com/RecordEvolution/ironflock-py
|
|
31
|
-
Project-URL: Issues, https://github.com/RecordEvolution/ironflock-py/issues
|
|
32
|
-
Classifier: Programming Language :: Python :: 3
|
|
33
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
-
Classifier: Operating System :: OS Independent
|
|
35
|
-
Requires-Python: >=3.6
|
|
7
|
+
Author-email: marko.petzold@record-evolution.de
|
|
8
|
+
License: MIT
|
|
9
|
+
Requires-Python: >=3.8
|
|
36
10
|
Description-Content-Type: text/markdown
|
|
37
11
|
License-File: LICENSE
|
|
38
12
|
Requires-Dist: autobahn[asyncio,serialization]==22.3.2
|
|
13
|
+
Dynamic: author
|
|
14
|
+
Dynamic: author-email
|
|
15
|
+
Dynamic: description
|
|
16
|
+
Dynamic: description-content-type
|
|
17
|
+
Dynamic: home-page
|
|
18
|
+
Dynamic: license
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
Dynamic: requires-dist
|
|
21
|
+
Dynamic: requires-python
|
|
22
|
+
Dynamic: summary
|
|
39
23
|
|
|
40
24
|
# ironflock
|
|
41
25
|
|
|
@@ -86,7 +70,7 @@ The `IronFlock` `__init__` function can be configured with the following options
|
|
|
86
70
|
## Advanced Usage
|
|
87
71
|
|
|
88
72
|
If you need more control, e.g. acting on lifecycle events (`onJoin`, `onLeave`) take a look at
|
|
89
|
-
the [examples](
|
|
73
|
+
the [examples](https://github.com/RecordEvolution/ironflock-py/tree/main/examples) folder.
|
|
90
74
|
|
|
91
75
|
|
|
92
76
|
## Development
|
|
@@ -47,7 +47,7 @@ The `IronFlock` `__init__` function can be configured with the following options
|
|
|
47
47
|
## Advanced Usage
|
|
48
48
|
|
|
49
49
|
If you need more control, e.g. acting on lifecycle events (`onJoin`, `onLeave`) take a look at
|
|
50
|
-
the [examples](
|
|
50
|
+
the [examples](https://github.com/RecordEvolution/ironflock-py/tree/main/examples) folder.
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
## Development
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import os
|
|
2
|
+
import asyncio
|
|
2
3
|
from typing import Optional
|
|
3
4
|
from autobahn.asyncio.component import Component, run
|
|
4
5
|
from autobahn.wamp.interfaces import ISession
|
|
5
|
-
from autobahn.wamp.types import PublishOptions
|
|
6
|
+
from autobahn.wamp.types import PublishOptions, RegisterOptions
|
|
6
7
|
from autobahn.wamp.request import Publication
|
|
7
8
|
|
|
8
9
|
from ironflock.AutobahnConnection import getSerialNumber, create_application_component
|
|
@@ -13,8 +14,6 @@ class IronFlock:
|
|
|
13
14
|
|
|
14
15
|
Example:
|
|
15
16
|
|
|
16
|
-
ironFlock = IronFlock()
|
|
17
|
-
|
|
18
17
|
async def main():
|
|
19
18
|
while True:
|
|
20
19
|
publication = await ironFlock.publish("test.publish.pw", 1, "two", 3, foo="bar")
|
|
@@ -23,7 +22,7 @@ class IronFlock:
|
|
|
23
22
|
|
|
24
23
|
|
|
25
24
|
if __name__ == "__main__":
|
|
26
|
-
|
|
25
|
+
ironflock = IronFlock(mainFunc=main)
|
|
27
26
|
ironFlock.run()
|
|
28
27
|
"""
|
|
29
28
|
|
|
@@ -45,17 +44,22 @@ class IronFlock:
|
|
|
45
44
|
async def onJoin(session, details):
|
|
46
45
|
print("component joined")
|
|
47
46
|
self._session = session
|
|
47
|
+
self._main_task = asyncio.create_task(mainFunc())
|
|
48
|
+
|
|
48
49
|
if self.mainFunc:
|
|
49
50
|
await self.mainFunc()
|
|
50
51
|
|
|
51
52
|
@self._component.on_disconnect
|
|
52
|
-
def onDisconnect(*args, **kwargs):
|
|
53
|
-
print("component disconnected")
|
|
54
|
-
self._session = None
|
|
55
|
-
|
|
56
53
|
@self._component.on_leave
|
|
57
|
-
def onLeave(*args, **kwargs):
|
|
54
|
+
async def onLeave(*args, **kwargs):
|
|
58
55
|
print("component left")
|
|
56
|
+
if self._main_task:
|
|
57
|
+
self._main_task.cancel()
|
|
58
|
+
try:
|
|
59
|
+
await self._main_task
|
|
60
|
+
except asyncio.CancelledError:
|
|
61
|
+
pass
|
|
62
|
+
self._main_task = None
|
|
59
63
|
self._session = None
|
|
60
64
|
|
|
61
65
|
@property
|
|
@@ -122,6 +126,24 @@ class IronFlock:
|
|
|
122
126
|
if hasattr(self, "_session") and hasattr(self._session, "call"):
|
|
123
127
|
res = await self._session.call('ironflock.location_service.update', payload, **extra)
|
|
124
128
|
return res
|
|
129
|
+
|
|
130
|
+
async def register_function(self, topic: str, func: function):
|
|
131
|
+
"""Registers a function to be called when a message is received on the given topic.
|
|
132
|
+
|
|
133
|
+
Args:
|
|
134
|
+
topic (str): The URI of the topic to register the function for, e.g. "example.mytopic1".
|
|
135
|
+
func (callable): The function to call when a message is received on the topic.
|
|
136
|
+
"""
|
|
137
|
+
swarm_key = os.environ.get("SWARM_KEY")
|
|
138
|
+
app_key = os.environ.get("APP_KEY")
|
|
139
|
+
env_value = os.environ.get("ENV")
|
|
140
|
+
|
|
141
|
+
topic = f"{swarm_key}.{self._device_key}.{app_key}.{env_value}.{topic}"
|
|
142
|
+
|
|
143
|
+
if self._session is not None:
|
|
144
|
+
await self._session.register(topic, func, options=RegisterOptions(force_reregister=True))
|
|
145
|
+
else:
|
|
146
|
+
print("cannot register function, not connected")
|
|
125
147
|
|
|
126
148
|
async def publish_to_table(
|
|
127
149
|
self, tablename: str, *args, **kwargs
|
|
@@ -1,41 +1,25 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: ironflock
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.4
|
|
4
4
|
Summary: SDK to integrate your IronFlock Industry 4 Apps with the IronFlock Data Infrastructure
|
|
5
|
-
Home-page: https://github.com/RecordEvolution/ironflock-
|
|
5
|
+
Home-page: https://github.com/RecordEvolution/ironflock-py
|
|
6
6
|
Author: Record Evolution GmbH
|
|
7
|
-
Author-email:
|
|
8
|
-
License: MIT
|
|
9
|
-
|
|
10
|
-
Copyright (c) 2021 Record Evolution
|
|
11
|
-
|
|
12
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
-
in the Software without restriction, including without limitation the rights
|
|
15
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
-
furnished to do so, subject to the following conditions:
|
|
18
|
-
|
|
19
|
-
The above copyright notice and this permission notice shall be included in all
|
|
20
|
-
copies or substantial portions of the Software.
|
|
21
|
-
|
|
22
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
-
SOFTWARE.
|
|
29
|
-
|
|
30
|
-
Project-URL: Homepage, https://github.com/RecordEvolution/ironflock-py
|
|
31
|
-
Project-URL: Issues, https://github.com/RecordEvolution/ironflock-py/issues
|
|
32
|
-
Classifier: Programming Language :: Python :: 3
|
|
33
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
-
Classifier: Operating System :: OS Independent
|
|
35
|
-
Requires-Python: >=3.6
|
|
7
|
+
Author-email: marko.petzold@record-evolution.de
|
|
8
|
+
License: MIT
|
|
9
|
+
Requires-Python: >=3.8
|
|
36
10
|
Description-Content-Type: text/markdown
|
|
37
11
|
License-File: LICENSE
|
|
38
12
|
Requires-Dist: autobahn[asyncio,serialization]==22.3.2
|
|
13
|
+
Dynamic: author
|
|
14
|
+
Dynamic: author-email
|
|
15
|
+
Dynamic: description
|
|
16
|
+
Dynamic: description-content-type
|
|
17
|
+
Dynamic: home-page
|
|
18
|
+
Dynamic: license
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
Dynamic: requires-dist
|
|
21
|
+
Dynamic: requires-python
|
|
22
|
+
Dynamic: summary
|
|
39
23
|
|
|
40
24
|
# ironflock
|
|
41
25
|
|
|
@@ -86,7 +70,7 @@ The `IronFlock` `__init__` function can be configured with the following options
|
|
|
86
70
|
## Advanced Usage
|
|
87
71
|
|
|
88
72
|
If you need more control, e.g. acting on lifecycle events (`onJoin`, `onLeave`) take a look at
|
|
89
|
-
the [examples](
|
|
73
|
+
the [examples](https://github.com/RecordEvolution/ironflock-py/tree/main/examples) folder.
|
|
90
74
|
|
|
91
75
|
|
|
92
76
|
## Development
|
|
@@ -10,16 +10,16 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
|
10
10
|
|
|
11
11
|
setup(
|
|
12
12
|
name="ironflock",
|
|
13
|
-
version="1.0.
|
|
14
|
-
description="
|
|
13
|
+
version="1.0.4",
|
|
14
|
+
description="SDK to integrate your IronFlock Industry 4 Apps with the IronFlock Data Infrastructure",
|
|
15
15
|
long_description=long_description,
|
|
16
16
|
long_description_content_type="text/markdown",
|
|
17
|
-
url="https://github.com/RecordEvolution/ironflock-
|
|
17
|
+
url="https://github.com/RecordEvolution/ironflock-py",
|
|
18
18
|
author="Record Evolution GmbH",
|
|
19
19
|
author_email="marko.petzold@record-evolution.de",
|
|
20
20
|
packages=find_packages(),
|
|
21
21
|
license="MIT",
|
|
22
|
-
python_requires=">=3.
|
|
22
|
+
python_requires=">=3.8",
|
|
23
23
|
install_requires=requirements,
|
|
24
24
|
classifiers=[],
|
|
25
25
|
)
|
ironflock-1.0.2/pyproject.toml
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
[project]
|
|
2
|
-
name = "ironflock"
|
|
3
|
-
version = "1.0.2"
|
|
4
|
-
authors = [
|
|
5
|
-
{ name = "Marko Petzold", email = "marko.petzold@record-evolution.de" },
|
|
6
|
-
]
|
|
7
|
-
description = "SDK to integrate your IronFlock Industry 4 Apps with the IronFlock Data Infrastructure"
|
|
8
|
-
readme = "README.md"
|
|
9
|
-
requires-python = ">=3.8"
|
|
10
|
-
license = { file = "LICENSE" } # Reference to the LICENSE file
|
|
11
|
-
classifiers = [
|
|
12
|
-
"Programming Language :: Python :: 3",
|
|
13
|
-
"License :: OSI Approved :: MIT License",
|
|
14
|
-
"Operating System :: OS Independent",
|
|
15
|
-
]
|
|
16
|
-
|
|
17
|
-
dependencies = [
|
|
18
|
-
"autobahn[asyncio,serialization]==22.3.2"
|
|
19
|
-
]
|
|
20
|
-
|
|
21
|
-
[project.urls]
|
|
22
|
-
Homepage = "https://github.com/RecordEvolution/ironflock-py"
|
|
23
|
-
Issues = "https://github.com/RecordEvolution/ironflock-py/issues"
|
|
24
|
-
|
|
25
|
-
[build-system]
|
|
26
|
-
requires = [
|
|
27
|
-
"setuptools>=42",
|
|
28
|
-
"wheel"
|
|
29
|
-
]
|
|
30
|
-
build-backend = "setuptools.build_meta"
|
|
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
|