singlestoredb 1.4.2__cp38-abi3-win32.whl → 1.4.3__cp38-abi3-win32.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.

Potentially problematic release.


This version of singlestoredb might be problematic. Click here for more details.

_singlestoredb_accel.pyd CHANGED
Binary file
singlestoredb/__init__.py CHANGED
@@ -13,7 +13,7 @@ Examples
13
13
 
14
14
  """
15
15
 
16
- __version__ = '1.4.2'
16
+ __version__ = '1.4.3'
17
17
 
18
18
  from typing import Any
19
19
 
@@ -123,14 +123,14 @@ class NamedList(List[T]):
123
123
  def _setup_authentication_info_handler() -> Callable[..., Dict[str, Any]]:
124
124
  """Setup authentication info event handler."""
125
125
 
126
- authentication_info: List[Tuple[str, Any]] = []
126
+ authentication_info: Dict[str, Any] = {}
127
127
 
128
128
  def handle_authentication_info(msg: Dict[str, Any]) -> None:
129
129
  """Handle authentication info events."""
130
130
  nonlocal authentication_info
131
131
  if msg.get('name', '') != 'singlestore.portal.authentication_updated':
132
132
  return
133
- authentication_info = list(msg.get('data', {}).items())
133
+ authentication_info = dict(msg.get('data', {}))
134
134
 
135
135
  events.subscribe(handle_authentication_info)
136
136
 
@@ -145,11 +145,27 @@ def _setup_authentication_info_handler() -> Callable[..., Dict[str, Any]]:
145
145
  out['user'] = data['user']
146
146
  if 'password' in data:
147
147
  out['password'] = data['password']
148
- authentication_info = list(out.items())
148
+ authentication_info = out
149
149
 
150
150
  events.subscribe(handle_authentication_info)
151
151
 
152
+ def retrieve_current_authentication_info() -> List[Tuple[str, Any]]:
153
+ """Retrieve JWT if not expired."""
154
+ nonlocal authentication_info
155
+ password = authentication_info.get('password')
156
+ if password:
157
+ expires = datetime.datetime.fromtimestamp(
158
+ jwt.decode(
159
+ password,
160
+ options={'verify_signature': False},
161
+ )['exp'],
162
+ )
163
+ if datetime.datetime.now() > expires:
164
+ authentication_info = {}
165
+ return list(authentication_info.items())
166
+
152
167
  def get_env() -> List[Tuple[str, Any]]:
168
+ """Retrieve JWT from environment."""
153
169
  conn = {}
154
170
  url = os.environ.get('SINGLESTOREDB_URL') or get_option('host')
155
171
  if url:
@@ -170,7 +186,7 @@ def _setup_authentication_info_handler() -> Callable[..., Dict[str, Any]]:
170
186
  return dict(
171
187
  itertools.chain(
172
188
  (get_env() if include_env else []),
173
- authentication_info,
189
+ retrieve_current_authentication_info(),
174
190
  ),
175
191
  )
176
192
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: singlestoredb
3
- Version: 1.4.2
3
+ Version: 1.4.3
4
4
  Summary: Interface to the SingleStoreDB database and workspace management APIs
5
5
  Home-page: https://github.com/singlestore-labs/singlestoredb-python
6
6
  Author: SingleStore
@@ -1,5 +1,5 @@
1
- _singlestoredb_accel.pyd,sha256=_knrtchzdfW_J4ne4LTVb_eGZ3DZAei-3Fjrhd3aOD4,59904
2
- singlestoredb/__init__.py,sha256=UAYUs5oB_C2Fltv2uVXynta2H-cBaMRVoJ4H_Wm9wCQ,1697
1
+ _singlestoredb_accel.pyd,sha256=JySQW9UIgy08VK7a0_0SsWZ6didExBbAyUUs4QIWxok,59904
2
+ singlestoredb/__init__.py,sha256=coTKAx_9TGFvUHphEf4cQk0Sd6wuK9ZrZuGjJmDVxw0,1697
3
3
  singlestoredb/auth.py,sha256=RmYiH0Wlc2RXc4pTlRMysxtBI445ggCIwojWKC_eDLE,7844
4
4
  singlestoredb/config.py,sha256=9pVmVEZ23NfJ3pokdBDA0cX3bwUz6SbuT4AZWAcIPR4,12235
5
5
  singlestoredb/connection.py,sha256=xdjf6HX-BS9BmwdjA3IlKeZx_e691_dVFMY3GvX_v64,46629
@@ -38,7 +38,7 @@ singlestoredb/management/cluster.py,sha256=XfdBuTlrAG-mnW1BFKeoAr4YSE5IVgxLjbuBS
38
38
  singlestoredb/management/manager.py,sha256=uGNrUe3zhuP-HUqdfwvy4MdEXTCmq-FZKjIwZSc3hOM,9096
39
39
  singlestoredb/management/organization.py,sha256=MjZ_tIoJGZwF95yfQ_Adz8LHYwkrKyj3p5JHDk6rWHE,5187
40
40
  singlestoredb/management/region.py,sha256=oGoLLS88dE1GmY7GCc0BV7X3f7bWwKQyeXOVBFmK9Pk,1678
41
- singlestoredb/management/utils.py,sha256=Etb0ZLs1X1UXVnLG4blLxtdl-nEnH0CTarjPykkzTo0,11144
41
+ singlestoredb/management/utils.py,sha256=uXrKlMnzlHj3qWO2vWCJP9mykUzIfbBxzZNN2vdXCvo,11775
42
42
  singlestoredb/management/workspace.py,sha256=BBNa3Af5IaUAwtzHWrNTJXoc8anXJ7FiWH9yIvtg79Q,63610
43
43
  singlestoredb/mysql/__init__.py,sha256=CbpwzNUJPAmKPpIobC0-ugBta_RgHCMq7X7N75QLReY,4669
44
44
  singlestoredb/mysql/_auth.py,sha256=YaqqyvAHmeraBv3BM207rNveUVPM-mPnW20ts_ynVWg,8341
@@ -115,9 +115,9 @@ singlestoredb/utils/events.py,sha256=rC9cHAetua_E1f-EiFkFM-gJzQSQIH5Uk-4sspC3KjI
115
115
  singlestoredb/utils/mogrify.py,sha256=gCcn99-vgsGVjTUV7RHJ6hH4vCNrsGB_Xo4z8kiSPDQ,4201
116
116
  singlestoredb/utils/results.py,sha256=wR70LhCqlobniZf52r67zYLBOKjWHQm68NAskdRQND8,15862
117
117
  singlestoredb/utils/xdict.py,sha256=-wi1lSPTnY99fhVMBhPKJ8cCsQhNG4GMUfkEBDKYgCw,13321
118
- singlestoredb-1.4.2.dist-info/LICENSE,sha256=Bojenzui8aPNjlF3w4ojguDP7sTf8vFV_9Gc2UAG1sg,11542
119
- singlestoredb-1.4.2.dist-info/METADATA,sha256=Qwbk_w8_e3LSOPA4BTPsndfdXfIb6B5fGE6RZdwA9P8,5710
120
- singlestoredb-1.4.2.dist-info/WHEEL,sha256=c4k7z5HB0t-y0nBCv6KyJ6KCjn8SEGPddD0lhaPtU3E,96
121
- singlestoredb-1.4.2.dist-info/entry_points.txt,sha256=bSLaTWB5zGjpVYPAaI46MkkDup0su-eb3uAhCNYuRV0,48
122
- singlestoredb-1.4.2.dist-info/top_level.txt,sha256=SDtemIXf-Kp-_F2f_S6x0db33cHGOILdAEsIQZe2LZc,35
123
- singlestoredb-1.4.2.dist-info/RECORD,,
118
+ singlestoredb-1.4.3.dist-info/LICENSE,sha256=Bojenzui8aPNjlF3w4ojguDP7sTf8vFV_9Gc2UAG1sg,11542
119
+ singlestoredb-1.4.3.dist-info/METADATA,sha256=JN_3ss7jeom5-_yVxjoSS-zCxNGwFTiqHEE5X991QZk,5710
120
+ singlestoredb-1.4.3.dist-info/WHEEL,sha256=c4k7z5HB0t-y0nBCv6KyJ6KCjn8SEGPddD0lhaPtU3E,96
121
+ singlestoredb-1.4.3.dist-info/entry_points.txt,sha256=bSLaTWB5zGjpVYPAaI46MkkDup0su-eb3uAhCNYuRV0,48
122
+ singlestoredb-1.4.3.dist-info/top_level.txt,sha256=SDtemIXf-Kp-_F2f_S6x0db33cHGOILdAEsIQZe2LZc,35
123
+ singlestoredb-1.4.3.dist-info/RECORD,,