diaspora-event-sdk 0.0.18__tar.gz → 0.0.19__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.
- {diaspora-event-sdk-0.0.18/diaspora_event_sdk.egg-info → diaspora-event-sdk-0.0.19}/PKG-INFO +29 -1
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/README.md +28 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/client.py +32 -5
- diaspora-event-sdk-0.0.19/diaspora_event_sdk/version.py +1 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19/diaspora_event_sdk.egg-info}/PKG-INFO +29 -1
- diaspora-event-sdk-0.0.18/diaspora_event_sdk/version.py +0 -1
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/LICENSE +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/MANIFEST.in +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/__init__.py +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/__init__.py +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/_environments.py +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/decorators.py +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/kafka_client.py +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/login_manager/__init__.py +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/login_manager/client_login.py +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/login_manager/decorators.py +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/login_manager/globus_auth.py +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/login_manager/login_flow.py +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/login_manager/manager.py +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/login_manager/protocol.py +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/login_manager/tokenstore.py +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/utils/__init__.py +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/utils/uuid_like.py +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/web_client.py +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk.egg-info/SOURCES.txt +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk.egg-info/dependency_links.txt +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk.egg-info/requires.txt +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk.egg-info/top_level.txt +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/setup.cfg +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/setup.py +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/tests/__init__.py +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/tests/unit/test_client.py +0 -0
- {diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/tox.ini +0 -0
{diaspora-event-sdk-0.0.18/diaspora_event_sdk.egg-info → diaspora-event-sdk-0.0.19}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: diaspora-event-sdk
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.19
|
|
4
4
|
Summary: SDK of Diaspora Event Fabric: Resilience-enabling services for science from HPC to edge
|
|
5
5
|
Home-page: https://github.com/globus-labs/diaspora-event-sdk
|
|
6
6
|
License: LICENSE
|
|
@@ -64,6 +64,14 @@ c = GlobusClient()
|
|
|
64
64
|
topic = "topic-" + c.subject_openid[-12:]
|
|
65
65
|
print(c.register_topic(topic))
|
|
66
66
|
print(c.list_topics())
|
|
67
|
+
|
|
68
|
+
# registration_status = c.register_topic(topic)
|
|
69
|
+
# print(registration_status)
|
|
70
|
+
# assert registration_status["status"] in ["no-op", "success"]
|
|
71
|
+
|
|
72
|
+
# registered_topics = c.list_topics()
|
|
73
|
+
# print(registered_topics)
|
|
74
|
+
# assert topic in registered_topics["topics"]
|
|
67
75
|
```
|
|
68
76
|
Register a topic also creates it, if the topic previously does not exist.
|
|
69
77
|
|
|
@@ -130,6 +138,26 @@ print(c.retrieve_key())
|
|
|
130
138
|
```
|
|
131
139
|
|
|
132
140
|
### Advanced Usage
|
|
141
|
+
#### Key Migration
|
|
142
|
+
In case you want to use the same credential (OpenID, secret key) on the second macine, but a call to create_key() invalidates all previous keys so you cannot rely on this API for generating a new key for the new machine, while keeping the old key on the old machine valid. Starting at 0.0.19, you can call the following code to retrieve the active secret key on the first machine and store it to the second machine, so that both machines hold valid keys.
|
|
143
|
+
|
|
144
|
+
On the first machine, call:
|
|
145
|
+
```python
|
|
146
|
+
from diaspora_event_sdk import Client as GlobusClient
|
|
147
|
+
c = GlobusClient()
|
|
148
|
+
print(c.get_secret_key()) # note down the secret key
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
On the second machine, call:
|
|
152
|
+
```python
|
|
153
|
+
from diaspora_event_sdk import Client as GlobusClient
|
|
154
|
+
from diaspora_event_sdk import block_until_ready
|
|
155
|
+
|
|
156
|
+
c = GlobusClient()
|
|
157
|
+
c.put_secret_key("<secret-key-from-first-machine>")
|
|
158
|
+
assert block_until_ready() # should unblock immediately
|
|
159
|
+
```
|
|
160
|
+
Note that a call to create_key() on any machine would invalidate the current key, on both machines.
|
|
133
161
|
|
|
134
162
|
#### Password Refresh
|
|
135
163
|
In case that you need to invalidate all previously issued passwords and generate a new one, call the `create_key` method from the `Client` class
|
|
@@ -53,6 +53,14 @@ c = GlobusClient()
|
|
|
53
53
|
topic = "topic-" + c.subject_openid[-12:]
|
|
54
54
|
print(c.register_topic(topic))
|
|
55
55
|
print(c.list_topics())
|
|
56
|
+
|
|
57
|
+
# registration_status = c.register_topic(topic)
|
|
58
|
+
# print(registration_status)
|
|
59
|
+
# assert registration_status["status"] in ["no-op", "success"]
|
|
60
|
+
|
|
61
|
+
# registered_topics = c.list_topics()
|
|
62
|
+
# print(registered_topics)
|
|
63
|
+
# assert topic in registered_topics["topics"]
|
|
56
64
|
```
|
|
57
65
|
Register a topic also creates it, if the topic previously does not exist.
|
|
58
66
|
|
|
@@ -119,6 +127,26 @@ print(c.retrieve_key())
|
|
|
119
127
|
```
|
|
120
128
|
|
|
121
129
|
### Advanced Usage
|
|
130
|
+
#### Key Migration
|
|
131
|
+
In case you want to use the same credential (OpenID, secret key) on the second macine, but a call to create_key() invalidates all previous keys so you cannot rely on this API for generating a new key for the new machine, while keeping the old key on the old machine valid. Starting at 0.0.19, you can call the following code to retrieve the active secret key on the first machine and store it to the second machine, so that both machines hold valid keys.
|
|
132
|
+
|
|
133
|
+
On the first machine, call:
|
|
134
|
+
```python
|
|
135
|
+
from diaspora_event_sdk import Client as GlobusClient
|
|
136
|
+
c = GlobusClient()
|
|
137
|
+
print(c.get_secret_key()) # note down the secret key
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
On the second machine, call:
|
|
141
|
+
```python
|
|
142
|
+
from diaspora_event_sdk import Client as GlobusClient
|
|
143
|
+
from diaspora_event_sdk import block_until_ready
|
|
144
|
+
|
|
145
|
+
c = GlobusClient()
|
|
146
|
+
c.put_secret_key("<secret-key-from-first-machine>")
|
|
147
|
+
assert block_until_ready() # should unblock immediately
|
|
148
|
+
```
|
|
149
|
+
Note that a call to create_key() on any machine would invalidate the current key, on both machines.
|
|
122
150
|
|
|
123
151
|
#### Password Refresh
|
|
124
152
|
In case that you need to invalidate all previously issued passwords and generate a new one, call the `create_key` method from the `Client` class
|
|
@@ -45,10 +45,7 @@ class Client:
|
|
|
45
45
|
tokens = self.login_manager._token_storage.get_token_data(
|
|
46
46
|
DIASPORA_RESOURCE_SERVER
|
|
47
47
|
)
|
|
48
|
-
tokens["
|
|
49
|
-
resp["access_key"],
|
|
50
|
-
resp["secret_key"],
|
|
51
|
-
)
|
|
48
|
+
tokens["secret_key"] = resp["secret_key"]
|
|
52
49
|
with self.login_manager._access_lock:
|
|
53
50
|
self.login_manager._token_storage._connection.executemany(
|
|
54
51
|
"REPLACE INTO token_storage(namespace, resource_server, token_data_json) "
|
|
@@ -72,11 +69,41 @@ class Client:
|
|
|
72
69
|
tokens = self.login_manager._token_storage.get_token_data(
|
|
73
70
|
DIASPORA_RESOURCE_SERVER
|
|
74
71
|
)
|
|
75
|
-
if tokens is None or "
|
|
72
|
+
if tokens is None or "secret_key" not in tokens:
|
|
76
73
|
return self.create_key()
|
|
77
74
|
else:
|
|
78
75
|
return {"username": self.subject_openid, "password": tokens["secret_key"]}
|
|
79
76
|
|
|
77
|
+
@requires_login
|
|
78
|
+
def get_secret_key(self):
|
|
79
|
+
tokens = self.login_manager._token_storage.get_token_data(
|
|
80
|
+
DIASPORA_RESOURCE_SERVER
|
|
81
|
+
)
|
|
82
|
+
if tokens is None or "secret_key" not in tokens:
|
|
83
|
+
return None
|
|
84
|
+
else:
|
|
85
|
+
return tokens["secret_key"]
|
|
86
|
+
|
|
87
|
+
@requires_login
|
|
88
|
+
def put_secret_key(self, secret_key):
|
|
89
|
+
tokens = self.login_manager._token_storage.get_token_data(
|
|
90
|
+
DIASPORA_RESOURCE_SERVER
|
|
91
|
+
)
|
|
92
|
+
tokens["secret_key"] = secret_key
|
|
93
|
+
with self.login_manager._access_lock:
|
|
94
|
+
self.login_manager._token_storage._connection.executemany(
|
|
95
|
+
"REPLACE INTO token_storage(namespace, resource_server, token_data_json) "
|
|
96
|
+
"VALUES(?, ?, ?)",
|
|
97
|
+
[
|
|
98
|
+
(
|
|
99
|
+
self.login_manager._token_storage.namespace,
|
|
100
|
+
DIASPORA_RESOURCE_SERVER,
|
|
101
|
+
json.dumps(tokens),
|
|
102
|
+
)
|
|
103
|
+
],
|
|
104
|
+
)
|
|
105
|
+
self.login_manager._token_storage._connection.commit()
|
|
106
|
+
|
|
80
107
|
@requires_login
|
|
81
108
|
def list_topics(self):
|
|
82
109
|
"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.0.19"
|
{diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19/diaspora_event_sdk.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: diaspora-event-sdk
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.19
|
|
4
4
|
Summary: SDK of Diaspora Event Fabric: Resilience-enabling services for science from HPC to edge
|
|
5
5
|
Home-page: https://github.com/globus-labs/diaspora-event-sdk
|
|
6
6
|
License: LICENSE
|
|
@@ -64,6 +64,14 @@ c = GlobusClient()
|
|
|
64
64
|
topic = "topic-" + c.subject_openid[-12:]
|
|
65
65
|
print(c.register_topic(topic))
|
|
66
66
|
print(c.list_topics())
|
|
67
|
+
|
|
68
|
+
# registration_status = c.register_topic(topic)
|
|
69
|
+
# print(registration_status)
|
|
70
|
+
# assert registration_status["status"] in ["no-op", "success"]
|
|
71
|
+
|
|
72
|
+
# registered_topics = c.list_topics()
|
|
73
|
+
# print(registered_topics)
|
|
74
|
+
# assert topic in registered_topics["topics"]
|
|
67
75
|
```
|
|
68
76
|
Register a topic also creates it, if the topic previously does not exist.
|
|
69
77
|
|
|
@@ -130,6 +138,26 @@ print(c.retrieve_key())
|
|
|
130
138
|
```
|
|
131
139
|
|
|
132
140
|
### Advanced Usage
|
|
141
|
+
#### Key Migration
|
|
142
|
+
In case you want to use the same credential (OpenID, secret key) on the second macine, but a call to create_key() invalidates all previous keys so you cannot rely on this API for generating a new key for the new machine, while keeping the old key on the old machine valid. Starting at 0.0.19, you can call the following code to retrieve the active secret key on the first machine and store it to the second machine, so that both machines hold valid keys.
|
|
143
|
+
|
|
144
|
+
On the first machine, call:
|
|
145
|
+
```python
|
|
146
|
+
from diaspora_event_sdk import Client as GlobusClient
|
|
147
|
+
c = GlobusClient()
|
|
148
|
+
print(c.get_secret_key()) # note down the secret key
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
On the second machine, call:
|
|
152
|
+
```python
|
|
153
|
+
from diaspora_event_sdk import Client as GlobusClient
|
|
154
|
+
from diaspora_event_sdk import block_until_ready
|
|
155
|
+
|
|
156
|
+
c = GlobusClient()
|
|
157
|
+
c.put_secret_key("<secret-key-from-first-machine>")
|
|
158
|
+
assert block_until_ready() # should unblock immediately
|
|
159
|
+
```
|
|
160
|
+
Note that a call to create_key() on any machine would invalidate the current key, on both machines.
|
|
133
161
|
|
|
134
162
|
#### Password Refresh
|
|
135
163
|
In case that you need to invalidate all previously issued passwords and generate a new one, call the `create_key` method from the `Client` class
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.0.18"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/_environments.py
RENAMED
|
File without changes
|
{diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/decorators.py
RENAMED
|
File without changes
|
{diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/kafka_client.py
RENAMED
|
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
|
{diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/utils/__init__.py
RENAMED
|
File without changes
|
{diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/utils/uuid_like.py
RENAMED
|
File without changes
|
{diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk/sdk/web_client.py
RENAMED
|
File without changes
|
{diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk.egg-info/requires.txt
RENAMED
|
File without changes
|
{diaspora-event-sdk-0.0.18 → diaspora-event-sdk-0.0.19}/diaspora_event_sdk.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|