diaspora-event-sdk 0.2.0__py3-none-any.whl → 0.2.1__py3-none-any.whl
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/sdk/client.py +5 -3
- diaspora_event_sdk/sdk/login_manager/client_login.py +4 -3
- diaspora_event_sdk/sdk/login_manager/globus_auth.py +4 -4
- diaspora_event_sdk/sdk/login_manager/login_flow.py +3 -2
- diaspora_event_sdk/sdk/web_client.py +3 -2
- diaspora_event_sdk/version.py +1 -1
- {diaspora_event_sdk-0.2.0.dist-info → diaspora_event_sdk-0.2.1.dist-info}/METADATA +1 -1
- {diaspora_event_sdk-0.2.0.dist-info → diaspora_event_sdk-0.2.1.dist-info}/RECORD +12 -12
- tests/unit/test_client.py +2 -2
- {diaspora_event_sdk-0.2.0.dist-info → diaspora_event_sdk-0.2.1.dist-info}/LICENSE +0 -0
- {diaspora_event_sdk-0.2.0.dist-info → diaspora_event_sdk-0.2.1.dist-info}/WHEEL +0 -0
- {diaspora_event_sdk-0.2.0.dist-info → diaspora_event_sdk-0.2.1.dist-info}/top_level.txt +0 -0
diaspora_event_sdk/sdk/client.py
CHANGED
|
@@ -175,18 +175,20 @@ class Client:
|
|
|
175
175
|
return self.web_client.list_triggers(self.subject_openid)
|
|
176
176
|
|
|
177
177
|
@requires_login
|
|
178
|
-
def create_trigger(self, topic, function, function_configs):
|
|
178
|
+
def create_trigger(self, topic, function, function_configs, trigger_configs):
|
|
179
179
|
"""
|
|
180
180
|
Registers a new functions under the user's OpenID.
|
|
181
181
|
"""
|
|
182
|
-
return self.web_client.create_trigger(self.subject_openid, topic, function, "create",
|
|
182
|
+
return self.web_client.create_trigger(self.subject_openid, topic, function, "create",
|
|
183
|
+
function_configs, trigger_configs)
|
|
183
184
|
|
|
184
185
|
@requires_login
|
|
185
186
|
def delete_trigger(self, topic, function):
|
|
186
187
|
"""
|
|
187
188
|
Unregisters a functions from the user's OpenID.
|
|
188
189
|
"""
|
|
189
|
-
return self.web_client.create_trigger(self.subject_openid, topic, function, "delete",
|
|
190
|
+
return self.web_client.create_trigger(self.subject_openid, topic, function, "delete",
|
|
191
|
+
{}, {})
|
|
190
192
|
|
|
191
193
|
@requires_login
|
|
192
194
|
def update_trigger(self, trigger_uuid, trigger_configs):
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
|
-
Logic for using client identities with the Diaspora
|
|
2
|
+
Logic for using client identities with the Diaspora SDK
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
The design is based on the Globus CLI client login:
|
|
5
5
|
https://github.com/globus/globus-cli/blob/main/src/globus_cli/login_manager/client_login.py
|
|
6
6
|
"""
|
|
7
7
|
from __future__ import annotations
|
|
@@ -9,13 +9,14 @@ from __future__ import annotations
|
|
|
9
9
|
import logging
|
|
10
10
|
import os
|
|
11
11
|
import uuid
|
|
12
|
+
from typing import Union
|
|
12
13
|
|
|
13
14
|
import globus_sdk
|
|
14
15
|
|
|
15
16
|
log = logging.getLogger(__name__)
|
|
16
17
|
|
|
17
18
|
|
|
18
|
-
def _get_client_creds_from_env() -> tuple[str
|
|
19
|
+
def _get_client_creds_from_env() -> tuple[Union[str, None], Union[str, None]]:
|
|
19
20
|
client_id = os.getenv("DIASPORA_SDK_CLIENT_ID")
|
|
20
21
|
client_secret = os.getenv("DIASPORA_SDK_CLIENT_SECRET")
|
|
21
22
|
return client_id, client_secret
|
|
@@ -3,14 +3,14 @@ import os
|
|
|
3
3
|
import globus_sdk
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
def internal_auth_client():
|
|
6
|
+
def internal_auth_client() -> globus_sdk.NativeAppAuthClient:
|
|
7
7
|
"""
|
|
8
|
-
This is the client that represents the Diaspora Event Fabric application itself
|
|
8
|
+
This is the client that represents the Diaspora Event Fabric application itself.
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
|
-
client_id = os.environ.get(
|
|
11
|
+
client_id: str = os.environ.get(
|
|
12
12
|
"DIASPORA_SDK_CLIENT_ID", "c5d4fab4-7f0d-422e-b0c8-5c74329b52fe"
|
|
13
13
|
)
|
|
14
14
|
return globus_sdk.NativeAppAuthClient(
|
|
15
15
|
client_id, app_name="Diaspora Event Fabric (internal client)"
|
|
16
|
-
)
|
|
16
|
+
)
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import platform
|
|
4
|
+
from typing import List
|
|
4
5
|
|
|
5
6
|
from .globus_auth import internal_auth_client
|
|
6
7
|
|
|
7
8
|
|
|
8
|
-
def do_link_auth_flow(scopes:
|
|
9
|
+
def do_link_auth_flow(scopes: List[str]):
|
|
9
10
|
auth_client = internal_auth_client()
|
|
10
11
|
|
|
11
12
|
# start the Confidential App Grant flow
|
|
@@ -31,4 +32,4 @@ def do_link_auth_flow(scopes: list[str]):
|
|
|
31
32
|
auth_code = input("Enter the resulting Authorization Code here: ").strip()
|
|
32
33
|
|
|
33
34
|
# finish auth flow
|
|
34
|
-
return auth_client.oauth2_exchange_code_for_tokens(auth_code)
|
|
35
|
+
return auth_client.oauth2_exchange_code_for_tokens(auth_code)
|
|
@@ -78,14 +78,15 @@ class WebClient(globus_sdk.BaseClient):
|
|
|
78
78
|
|
|
79
79
|
def create_trigger(
|
|
80
80
|
self, subject: UUID_LIKE_T, topic: str, function: str, action: str,
|
|
81
|
-
function_configs: dict
|
|
81
|
+
function_configs: dict, trigger_configs: dict
|
|
82
82
|
) -> globus_sdk.GlobusHTTPResponse:
|
|
83
83
|
return self.put(
|
|
84
84
|
"/api/v2/trigger",
|
|
85
85
|
headers={"Subject": str(subject), "Topic": topic,
|
|
86
86
|
"Trigger": function, "Action": action,
|
|
87
87
|
"Content-Type": "text/plain"},
|
|
88
|
-
data=json.dumps(
|
|
88
|
+
data=json.dumps({"function": function_configs,
|
|
89
|
+
"trigger": trigger_configs}).encode("utf-8")
|
|
89
90
|
)
|
|
90
91
|
|
|
91
92
|
def update_trigger(
|
diaspora_event_sdk/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.2.
|
|
1
|
+
__version__ = "0.2.1"
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
diaspora_event_sdk/__init__.py,sha256=v8IN3-WFpliakQKru8TAcmQ4IRdvRe_m9-abSDnGIFM,457
|
|
2
|
-
diaspora_event_sdk/version.py,sha256=
|
|
2
|
+
diaspora_event_sdk/version.py,sha256=HfjVOrpTnmZ-xVFCYSVmX50EXaBQeJteUHG-PD6iQs8,22
|
|
3
3
|
diaspora_event_sdk/sdk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
diaspora_event_sdk/sdk/_environments.py,sha256=QyQA7dV4goUKUoxAoaes8OGv0xKxz2qiFBHNGr-vQNA,204
|
|
5
|
-
diaspora_event_sdk/sdk/client.py,sha256=
|
|
5
|
+
diaspora_event_sdk/sdk/client.py,sha256=z3GT9k3gJUkoT3b2LactWnSIBIJQ6zfp6gOL7z9bIuw,6964
|
|
6
6
|
diaspora_event_sdk/sdk/decorators.py,sha256=Gel8AyhIjbf4-FNintTNcOqvC9hHH_YwbOH257Nfmf0,884
|
|
7
7
|
diaspora_event_sdk/sdk/kafka_client.py,sha256=G1kQQz2TWlahdd2TDdpvaQW7HD7gsuQCnr0tks54ISw,4361
|
|
8
|
-
diaspora_event_sdk/sdk/web_client.py,sha256=
|
|
8
|
+
diaspora_event_sdk/sdk/web_client.py,sha256=gU7XflHXkNwz017qqhX9Dc-Z-EDNTgmLO30KG8pPCkw,3724
|
|
9
9
|
diaspora_event_sdk/sdk/login_manager/__init__.py,sha256=yeqVgjeHLMX0WZJu2feJmq-fbeXvSxWghVV81ygfY-w,239
|
|
10
|
-
diaspora_event_sdk/sdk/login_manager/client_login.py,sha256=
|
|
10
|
+
diaspora_event_sdk/sdk/login_manager/client_login.py,sha256=8ild28_cgPSrLtg3Jhmzpg3EymAvH2UdAhKY52oOB_c,1835
|
|
11
11
|
diaspora_event_sdk/sdk/login_manager/decorators.py,sha256=EFEp71d0oJ7vo2H8W7DJ2gPrDfGzeNXUNxri1C0l8h0,1047
|
|
12
|
-
diaspora_event_sdk/sdk/login_manager/globus_auth.py,sha256=
|
|
13
|
-
diaspora_event_sdk/sdk/login_manager/login_flow.py,sha256=
|
|
12
|
+
diaspora_event_sdk/sdk/login_manager/globus_auth.py,sha256=pbDy67Mdf4SKFf0IlXD3ZFGj4lG-xpzFTD1ygW-0H1k,430
|
|
13
|
+
diaspora_event_sdk/sdk/login_manager/login_flow.py,sha256=6Vi_e3rACYdv4TRXPAvUv5xivCRkCo4DS841Ixu_r24,977
|
|
14
14
|
diaspora_event_sdk/sdk/login_manager/manager.py,sha256=AD3f8rx154oesgkpqG0K-eZsEGjntr08Vgrxr1m6uao,7040
|
|
15
15
|
diaspora_event_sdk/sdk/login_manager/protocol.py,sha256=RCuo2jy_XkpZvbxnKlDfTKs-L6b9_8_JR-Kq9wHwhoM,710
|
|
16
16
|
diaspora_event_sdk/sdk/login_manager/tokenstore.py,sha256=Kq0IZGf9G9dE44yoyUZInod5xL_8caN9OugeTK6GBGg,2094
|
|
17
17
|
diaspora_event_sdk/sdk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
18
|
diaspora_event_sdk/sdk/utils/uuid_like.py,sha256=xbxf0YXpDhdii16lwPLWRN21qFekHrNrqODSToMPtCg,470
|
|
19
19
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
|
-
tests/unit/test_client.py,sha256=
|
|
21
|
-
diaspora_event_sdk-0.2.
|
|
22
|
-
diaspora_event_sdk-0.2.
|
|
23
|
-
diaspora_event_sdk-0.2.
|
|
24
|
-
diaspora_event_sdk-0.2.
|
|
25
|
-
diaspora_event_sdk-0.2.
|
|
20
|
+
tests/unit/test_client.py,sha256=sJUtPmnNGnohnP38RQrwcJ4D5j3-g1WFQ6gaKf520AQ,3019
|
|
21
|
+
diaspora_event_sdk-0.2.1.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
|
22
|
+
diaspora_event_sdk-0.2.1.dist-info/METADATA,sha256=nnSC7OK1sDESBpFe177-b5O_DK3qz-HRuBpeFNraAgg,2505
|
|
23
|
+
diaspora_event_sdk-0.2.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
24
|
+
diaspora_event_sdk-0.2.1.dist-info/top_level.txt,sha256=OVun-67t3fkLFEIwvJuNINgFFvAc--bClYhXjLhMmvs,25
|
|
25
|
+
diaspora_event_sdk-0.2.1.dist-info/RECORD,,
|
tests/unit/test_client.py
CHANGED
|
@@ -91,10 +91,10 @@ def test_list_topics(client):
|
|
|
91
91
|
def test_register_topic(client):
|
|
92
92
|
topic = "test_topic"
|
|
93
93
|
client.register_topic(topic)
|
|
94
|
-
client.web_client.register_topic.assert_called_with("test_sub", topic)
|
|
94
|
+
client.web_client.register_topic.assert_called_with("test_sub", topic, "register")
|
|
95
95
|
|
|
96
96
|
|
|
97
97
|
def test_unregister_topic(client):
|
|
98
98
|
topic = "test_topic"
|
|
99
99
|
client.unregister_topic(topic)
|
|
100
|
-
client.web_client.
|
|
100
|
+
client.web_client.register_topic.assert_called_with("test_sub", topic, "unregister")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|