diaspora-event-sdk 0.0.15__tar.gz → 0.0.16__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.
Files changed (33) hide show
  1. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/PKG-INFO +19 -1
  2. diaspora-event-sdk-0.0.15/readme.md → diaspora-event-sdk-0.0.16/README.md +19 -1
  3. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk/sdk/client.py +27 -18
  4. diaspora-event-sdk-0.0.16/diaspora_event_sdk/version.py +1 -0
  5. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk.egg-info/PKG-INFO +19 -1
  6. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk.egg-info/SOURCES.txt +1 -1
  7. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/setup.py +1 -1
  8. diaspora-event-sdk-0.0.15/diaspora_event_sdk/version.py +0 -1
  9. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/LICENSE +0 -0
  10. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/MANIFEST.in +0 -0
  11. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk/__init__.py +0 -0
  12. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk/sdk/__init__.py +0 -0
  13. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk/sdk/_environments.py +0 -0
  14. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk/sdk/decorators.py +0 -0
  15. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk/sdk/kafka_client.py +0 -0
  16. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk/sdk/login_manager/__init__.py +0 -0
  17. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk/sdk/login_manager/client_login.py +0 -0
  18. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk/sdk/login_manager/decorators.py +0 -0
  19. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk/sdk/login_manager/globus_auth.py +0 -0
  20. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk/sdk/login_manager/login_flow.py +0 -0
  21. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk/sdk/login_manager/manager.py +0 -0
  22. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk/sdk/login_manager/protocol.py +0 -0
  23. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk/sdk/login_manager/tokenstore.py +0 -0
  24. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk/sdk/utils/__init__.py +0 -0
  25. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk/sdk/utils/uuid_like.py +0 -0
  26. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk/sdk/web_client.py +0 -0
  27. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk.egg-info/dependency_links.txt +0 -0
  28. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk.egg-info/requires.txt +0 -0
  29. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/diaspora_event_sdk.egg-info/top_level.txt +0 -0
  30. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/setup.cfg +0 -0
  31. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/tests/__init__.py +0 -0
  32. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/tests/unit/test_client.py +0 -0
  33. {diaspora-event-sdk-0.0.15 → diaspora-event-sdk-0.0.16}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: diaspora-event-sdk
3
- Version: 0.0.15
3
+ Version: 0.0.16
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
@@ -136,3 +136,21 @@ It seems that you ran `pip install diaspora-event-sdk` to install the Diaspora E
136
136
 
137
137
  ### kafka.errors.NoBrokersAvailable and kafka.errors.NodeNotReadyError
138
138
  These messages might pop up if `create_key` is called shortly before instanciating a Kafka client. This is because there's a delay for AWS Secret Manager to associate the newly generated credential with MSK. Note that `create_key` is called internally by `kafka_client.py` the first time you create one of these clients. Please wait a while (around 1 minute) and retry.
139
+
140
+ ### kafka.errors.KafkaTimeoutError: KafkaTimeoutError: Failed to update metadata after 60.0 secs.
141
+ **Step 1: Verify Topic Creation and Access:**
142
+ Before interacting with the producer/consumer, ensure that the topic has been successfully created and access is granted to you. Execute the following command:
143
+
144
+ ```python
145
+ from diaspora_event_sdk import Client as GlobusClient
146
+ c = GlobusClient()
147
+ # topic = <the topic you want to use>
148
+ print(c.register_topic(topic))
149
+ ```
150
+ This should return a `status: no-op` message, indicating that the topic is already registered and accessible.
151
+
152
+ **Step 2: Wait Automatic Key Creation in KafkaProducer and KafkaConsumer**
153
+ `KafkaProducer` and `KafkaConsumer` would internally call `create_key` if the keys are not found locally (e.g., when you first authenticated with Globus). Behind the sence, the middle service contacts AWS to initialize the asynchronous process of creating and associating the secret. Please wait a while (around 1 minute) and retry.
154
+
155
+ ### ssl.SSLCertVerificationError
156
+ This is commmon on MacOS system, see [this StackOverflow answer](https://stackoverflow.com/a/53310545).
@@ -125,4 +125,22 @@ Subsequent calls to `retrieve_key` will return the new password from the cache.
125
125
  It seems that you ran `pip install diaspora-event-sdk` to install the Diaspora Event SDK without `kafka-python`. Run `pip install kafka-python` to install the necessary dependency for our `KafkaProducer` and `KafkaConsumer` classes.
126
126
 
127
127
  ### kafka.errors.NoBrokersAvailable and kafka.errors.NodeNotReadyError
128
- These messages might pop up if `create_key` is called shortly before instanciating a Kafka client. This is because there's a delay for AWS Secret Manager to associate the newly generated credential with MSK. Note that `create_key` is called internally by `kafka_client.py` the first time you create one of these clients. Please wait a while (around 1 minute) and retry.
128
+ These messages might pop up if `create_key` is called shortly before instanciating a Kafka client. This is because there's a delay for AWS Secret Manager to associate the newly generated credential with MSK. Note that `create_key` is called internally by `kafka_client.py` the first time you create one of these clients. Please wait a while (around 1 minute) and retry.
129
+
130
+ ### kafka.errors.KafkaTimeoutError: KafkaTimeoutError: Failed to update metadata after 60.0 secs.
131
+ **Step 1: Verify Topic Creation and Access:**
132
+ Before interacting with the producer/consumer, ensure that the topic has been successfully created and access is granted to you. Execute the following command:
133
+
134
+ ```python
135
+ from diaspora_event_sdk import Client as GlobusClient
136
+ c = GlobusClient()
137
+ # topic = <the topic you want to use>
138
+ print(c.register_topic(topic))
139
+ ```
140
+ This should return a `status: no-op` message, indicating that the topic is already registered and accessible.
141
+
142
+ **Step 2: Wait Automatic Key Creation in KafkaProducer and KafkaConsumer**
143
+ `KafkaProducer` and `KafkaConsumer` would internally call `create_key` if the keys are not found locally (e.g., when you first authenticated with Globus). Behind the sence, the middle service contacts AWS to initialize the asynchronous process of creating and associating the secret. Please wait a while (around 1 minute) and retry.
144
+
145
+ ### ssl.SSLCertVerificationError
146
+ This is commmon on MacOS system, see [this StackOverflow answer](https://stackoverflow.com/a/53310545).
@@ -1,12 +1,16 @@
1
- from typing import Optional
2
1
  import json
2
+ from typing import Optional
3
3
 
4
- from diaspora_event_sdk.sdk.login_manager import LoginManager, LoginManagerProtocol, requires_login
5
- from ._environments import TOKEN_EXCHANGE, DIASPORA_RESOURCE_SERVER
4
+ from diaspora_event_sdk.sdk.login_manager import (
5
+ LoginManager,
6
+ LoginManagerProtocol,
7
+ requires_login,
8
+ )
6
9
 
10
+ from ._environments import DIASPORA_RESOURCE_SERVER, TOKEN_EXCHANGE
7
11
 
8
- class Client:
9
12
 
13
+ class Client:
10
14
  def __init__(
11
15
  self,
12
16
  environment: Optional[str] = None,
@@ -21,9 +25,7 @@ class Client:
21
25
  self.login_manager = LoginManager(environment=environment)
22
26
  self.login_manager.ensure_logged_in()
23
27
 
24
- self.web_client = self.login_manager.get_web_client(
25
- base_url=TOKEN_EXCHANGE
26
- )
28
+ self.web_client = self.login_manager.get_web_client(base_url=TOKEN_EXCHANGE)
27
29
  self.auth_client = self.login_manager.get_auth_client()
28
30
  self.subject_openid = self.auth_client.oauth2_userinfo()["sub"]
29
31
 
@@ -41,20 +43,26 @@ class Client:
41
43
  raise Exception("should not happen")
42
44
 
43
45
  tokens = self.login_manager._token_storage.get_token_data(
44
- DIASPORA_RESOURCE_SERVER)
45
- tokens['access_key'], tokens['secret_key'] = resp['access_key'], resp['secret_key']
46
+ DIASPORA_RESOURCE_SERVER
47
+ )
48
+ tokens["access_key"], tokens["secret_key"] = (
49
+ resp["access_key"],
50
+ resp["secret_key"],
51
+ )
46
52
  with self.login_manager._access_lock:
47
53
  self.login_manager._token_storage._connection.executemany(
48
54
  "REPLACE INTO token_storage(namespace, resource_server, token_data_json) "
49
55
  "VALUES(?, ?, ?)",
50
56
  [
51
- (self.login_manager._token_storage.namespace,
52
- DIASPORA_RESOURCE_SERVER,
53
- json.dumps(tokens))
57
+ (
58
+ self.login_manager._token_storage.namespace,
59
+ DIASPORA_RESOURCE_SERVER,
60
+ json.dumps(tokens),
61
+ )
54
62
  ],
55
63
  )
56
64
  self.login_manager._token_storage._connection.commit()
57
- return {"username": self.subject_openid, "password": tokens['secret_key']}
65
+ return {"username": self.subject_openid, "password": tokens["secret_key"]}
58
66
 
59
67
  @requires_login
60
68
  def retrieve_key(self):
@@ -62,29 +70,30 @@ class Client:
62
70
  Attempt to retrieve the key from local token storage, and call create_key if local key is not found
63
71
  """
64
72
  tokens = self.login_manager._token_storage.get_token_data(
65
- DIASPORA_RESOURCE_SERVER)
73
+ DIASPORA_RESOURCE_SERVER
74
+ )
66
75
  if tokens is None or "access_key" not in tokens or "secret_key" not in tokens:
67
76
  return self.create_key()
68
77
  else:
69
- return {"username": self.subject_openid, "password": tokens['secret_key']}
78
+ return {"username": self.subject_openid, "password": tokens["secret_key"]}
70
79
 
71
80
  @requires_login
72
81
  def list_topics(self):
73
82
  """
74
- Retrieves the list of topics associated with the user's OpenID.
83
+ Retrieves the list of topics associated with the user's OpenID.
75
84
  """
76
85
  return self.web_client.list_topics(self.subject_openid)
77
86
 
78
87
  @requires_login
79
88
  def register_topic(self, topic):
80
89
  """
81
- Registers a new topic under the user's OpenID.
90
+ Registers a new topic under the user's OpenID.
82
91
  """
83
92
  return self.web_client.register_topic(self.subject_openid, topic)
84
93
 
85
94
  @requires_login
86
95
  def unregister_topic(self, topic):
87
96
  """
88
- Unregisters a topic from the user's OpenID.
97
+ Unregisters a topic from the user's OpenID.
89
98
  """
90
99
  return self.web_client.unregister_topic(self.subject_openid, topic)
@@ -0,0 +1 @@
1
+ __version__ = "0.0.16"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: diaspora-event-sdk
3
- Version: 0.0.15
3
+ Version: 0.0.16
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
@@ -136,3 +136,21 @@ It seems that you ran `pip install diaspora-event-sdk` to install the Diaspora E
136
136
 
137
137
  ### kafka.errors.NoBrokersAvailable and kafka.errors.NodeNotReadyError
138
138
  These messages might pop up if `create_key` is called shortly before instanciating a Kafka client. This is because there's a delay for AWS Secret Manager to associate the newly generated credential with MSK. Note that `create_key` is called internally by `kafka_client.py` the first time you create one of these clients. Please wait a while (around 1 minute) and retry.
139
+
140
+ ### kafka.errors.KafkaTimeoutError: KafkaTimeoutError: Failed to update metadata after 60.0 secs.
141
+ **Step 1: Verify Topic Creation and Access:**
142
+ Before interacting with the producer/consumer, ensure that the topic has been successfully created and access is granted to you. Execute the following command:
143
+
144
+ ```python
145
+ from diaspora_event_sdk import Client as GlobusClient
146
+ c = GlobusClient()
147
+ # topic = <the topic you want to use>
148
+ print(c.register_topic(topic))
149
+ ```
150
+ This should return a `status: no-op` message, indicating that the topic is already registered and accessible.
151
+
152
+ **Step 2: Wait Automatic Key Creation in KafkaProducer and KafkaConsumer**
153
+ `KafkaProducer` and `KafkaConsumer` would internally call `create_key` if the keys are not found locally (e.g., when you first authenticated with Globus). Behind the sence, the middle service contacts AWS to initialize the asynchronous process of creating and associating the secret. Please wait a while (around 1 minute) and retry.
154
+
155
+ ### ssl.SSLCertVerificationError
156
+ This is commmon on MacOS system, see [this StackOverflow answer](https://stackoverflow.com/a/53310545).
@@ -1,6 +1,6 @@
1
1
  LICENSE
2
2
  MANIFEST.in
3
- readme.md
3
+ README.md
4
4
  setup.py
5
5
  tox.ini
6
6
  diaspora_event_sdk/__init__.py
@@ -19,7 +19,7 @@ def parse_version():
19
19
  return version_string
20
20
 
21
21
  directory = Path(__file__).parent
22
- long_description = (directory / "readme.md").read_text()
22
+ long_description = (directory / "README.md").read_text()
23
23
 
24
24
  setup(
25
25
  name='diaspora-event-sdk',
@@ -1 +0,0 @@
1
- __version__ = "0.0.15"