meerschaum 2.7.9__py3-none-any.whl → 2.7.10__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,7 +32,7 @@ class TermPageHandler(tornado_web.RequestHandler):
32
32
  return self.render(
33
33
  "termpage.html",
34
34
  static=self.static_url,
35
- ws_url_path=f"/_websocket/{term_name}",
35
+ ws_url_path=f"/websocket/{term_name}",
36
36
  )
37
37
 
38
38
 
@@ -51,7 +51,7 @@ def get_webterm_app_and_manager(
51
51
  term_manager = terminado.NamedTermManager(shell_command=commands)
52
52
  handlers = [
53
53
  (
54
- r"/_websocket/(.+)/?",
54
+ r"/websocket/(.+)/?",
55
55
  CustomTermSocket,
56
56
  {'term_manager': term_manager}
57
57
  ),
meerschaum/actions/api.py CHANGED
@@ -140,16 +140,28 @@ def _api_start(
140
140
  If provided, serve over HTTPS with this certfile.
141
141
  Requires `--keyfile`.
142
142
  """
143
+ import json
144
+ import sys
145
+ import shutil
146
+ import pathlib
147
+ from copy import deepcopy
148
+
143
149
  from meerschaum.utils.packages import (
144
- attempt_import, venv_contains_package, pip_install, run_python_package
150
+ attempt_import,
151
+ venv_contains_package,
152
+ pip_install,
153
+ run_python_package,
145
154
  )
146
155
  from meerschaum.utils.misc import is_int, filter_keywords
156
+ from meerschaum.utils.dtypes import json_serialize_value
147
157
  from meerschaum.utils.formatting import pprint, ANSI, _init
148
158
  from meerschaum.utils.debug import dprint
149
159
  from meerschaum.utils.warnings import error, warn
150
160
  from meerschaum.config import get_config, _config
151
161
  from meerschaum.config._paths import (
152
- API_UVICORN_RESOURCES_PATH, API_UVICORN_CONFIG_PATH, CACHE_RESOURCES_PATH,
162
+ API_UVICORN_RESOURCES_PATH,
163
+ API_UVICORN_CONFIG_PATH,
164
+ CACHE_RESOURCES_PATH,
153
165
  PACKAGE_ROOT_PATH,
154
166
  )
155
167
  from meerschaum.config._patch import apply_patch_to_config
@@ -157,8 +169,6 @@ def _api_start(
157
169
  from meerschaum.config.static import STATIC_CONFIG, SERVER_ID
158
170
  from meerschaum.connectors.parse import parse_instance_keys
159
171
  from meerschaum.utils.pool import get_pool
160
- import shutil
161
- from copy import deepcopy
162
172
 
163
173
  if action is None:
164
174
  action = []
@@ -256,7 +266,6 @@ def _api_start(
256
266
  custom_keys = ['mrsm_instance', 'no_dash', 'no_auth', 'private', 'debug', 'production']
257
267
 
258
268
  ### write config to a temporary file to communicate with uvicorn threads
259
- import json, sys
260
269
  try:
261
270
  if uvicorn_config_path.exists():
262
271
  os.remove(uvicorn_config_path)
@@ -275,12 +284,25 @@ def _api_start(
275
284
  MRSM_RUNTIME = STATIC_CONFIG['environment']['runtime']
276
285
  MRSM_PATCH = STATIC_CONFIG['environment']['patch']
277
286
  MRSM_ROOT_DIR = STATIC_CONFIG['environment']['root']
278
- env_dict = {
287
+ env_dict = {}
288
+ env_dict.update({
279
289
  MRSM_SERVER_ID: SERVER_ID,
280
290
  MRSM_RUNTIME: 'api',
281
291
  MRSM_CONFIG: json.loads(os.environ.get(MRSM_CONFIG, '{}')),
282
292
  'FORWARDED_ALLOW_IPS': forwarded_allow_ips,
283
- }
293
+ 'TERM': os.environ.get('TERM', 'screen-256color'),
294
+ 'SHELL': os.environ.get('SHELL', '/bin/bash'),
295
+ 'LANG': os.environ.get('LANG', 'C.UTF-8'),
296
+ 'HOME': os.environ.get('HOME', pathlib.Path.home().as_posix()),
297
+ 'PATH': os.environ.get(
298
+ 'PATH',
299
+ (
300
+ '/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin:'
301
+ f'{pathlib.Path.home().as_posix().rstrip("/")}/.local/bin'
302
+ )
303
+ ),
304
+ 'HOSTNAME': os.environ.get('HOSTNAME', 'api'),
305
+ })
284
306
  for env_var in get_env_vars():
285
307
  if env_var in env_dict:
286
308
  continue
@@ -294,10 +316,10 @@ def _api_start(
294
316
  env_text = ''
295
317
  for key, val in env_dict.items():
296
318
  value = str(
297
- json.dumps(val)
319
+ json.dumps(val, default=json_serialize_value)
298
320
  if isinstance(val, (dict))
299
321
  else val
300
- ).replace('\\', '\\\\')
322
+ ).replace('\\', '\\\\').replace("'", "'\\''")
301
323
  env_text += f"{key}='{value}'\n"
302
324
  with open(uvicorn_env_path, 'w+', encoding='utf-8') as f:
303
325
  if debug:
@@ -329,7 +351,11 @@ def _api_start(
329
351
  for key, val in env_dict.items():
330
352
  gunicorn_args += [
331
353
  '--env', key + "="
332
- + (json.dumps(val) if isinstance(val, (dict, list)) else val)
354
+ + (
355
+ json.dumps(val, default=json_serialize_value)
356
+ if isinstance(val, (dict, list))
357
+ else val
358
+ )
333
359
  ]
334
360
  if workers is not None:
335
361
  gunicorn_args += ['--workers', str(workers)]
@@ -76,7 +76,7 @@ async def get_webterm(
76
76
  text = response.text
77
77
  if request.url.scheme == 'https':
78
78
  text = text.replace('ws://', 'wss://')
79
- text = text.replace(f'_websocket/{username}', f'_websocket/{session_id}')
79
+ text = text.replace(f'websocket/{username}', f'websocket/{session_id}')
80
80
  return HTMLResponse(
81
81
  content=text,
82
82
  status_code=response.status_code,
@@ -100,7 +100,7 @@ async def webterm_websocket(websocket: WebSocket, session_id: str):
100
100
 
101
101
  username = get_username_from_session(session_id)
102
102
 
103
- ws_url = f"ws://localhost:8765/_websocket/{username or session_id}"
103
+ ws_url = f"ws://localhost:8765/websocket/{username or session_id}"
104
104
  async with websockets.connect(ws_url) as ws:
105
105
  async def forward_messages():
106
106
  try:
@@ -2,4 +2,4 @@
2
2
  Specify the Meerschaum release version.
3
3
  """
4
4
 
5
- __version__ = "2.7.9"
5
+ __version__ = "2.7.10"
@@ -33,7 +33,7 @@ STATIC_CONFIG: Dict[str, Any] = {
33
33
  'websocket': '/ws',
34
34
  'dash': '/dash',
35
35
  'webterm': r'/webterm/{session_id}',
36
- 'webterm_websocket': r'/_websocket/{session_id}',
36
+ 'webterm_websocket': r'/websocket/{session_id}',
37
37
  'info': '/info',
38
38
  'healthcheck': '/healthcheck',
39
39
  },
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: meerschaum
3
- Version: 2.7.9
3
+ Version: 2.7.10
4
4
  Summary: Sync Time-Series Pipes with Meerschaum
5
5
  Home-page: https://meerschaum.io
6
6
  Author: Bennett Meares
@@ -18,11 +18,11 @@ meerschaum/_internal/shell/ValidAutoSuggest.py,sha256=bARjOWMidz0dvMelLUe6yRPto5
18
18
  meerschaum/_internal/shell/__init__.py,sha256=vXQoQPEVlYiUYai1b5AwQAlTnja6A2cSABnqXhzlS7I,281
19
19
  meerschaum/_internal/shell/updates.py,sha256=FmKu1NsIE7AI1zq8zNeKneZzORv6BeURQeX0lRR81Ag,5040
20
20
  meerschaum/_internal/shell/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
- meerschaum/_internal/term/TermPageHandler.py,sha256=iRvd1v7WsyZE2H7spXkz4vxtolV6IvbhkBLhkke9r5g,2421
22
- meerschaum/_internal/term/__init__.py,sha256=6hkhA5Hk0O3WrwYYu74itcKTm5MxlOAVM1ozTojwB7c,2162
21
+ meerschaum/_internal/term/TermPageHandler.py,sha256=C43gVMBWvC74eS4MDYKPfPvyCS0TpdzfLB_4hjFgCDM,2420
22
+ meerschaum/_internal/term/__init__.py,sha256=oRjQXBvyAIEjf-k_neb614lYOuTPEKtimDn3aKgAgos,2161
23
23
  meerschaum/_internal/term/tools.py,sha256=7Hb6W9G1nHZHAhzuJjatuP1IK9XZTgUXDRPk7H9Tkpg,1609
24
24
  meerschaum/actions/__init__.py,sha256=MHPs8aRBhbZQXnqd_6tVtisTrNCgPAPgnNcXYbn0zP8,11640
25
- meerschaum/actions/api.py,sha256=41r3fBh3vAPyNaOrvbh2oh6WUJTR2I-zaOEZN60A66E,12538
25
+ meerschaum/actions/api.py,sha256=RsQKtTHcxfoXw6BIpz36unUSFo2m9huATGBQUhQw2TU,13392
26
26
  meerschaum/actions/attach.py,sha256=UV19d9W_2WYcrf7BRz7k3mriDoX1V4rA4AKvbLdor0o,3106
27
27
  meerschaum/actions/bootstrap.py,sha256=08o3PchrJ_Rv8IP30ZBH1Ovk-b8qFBGPedCjF7jRzSo,18084
28
28
  meerschaum/actions/clear.py,sha256=v_xHn7-Pu7iwFNJ07q9eJt2hqPV7OwNZHUYa9dvixs4,4976
@@ -129,7 +129,7 @@ meerschaum/api/routes/_pipes.py,sha256=kykrEP6A75WBjn2wP28BLiPVRpwtfd8sVhfOhzjHa
129
129
  meerschaum/api/routes/_plugins.py,sha256=zzUyCiylJGeoLoa3dNjeRMSspvKfywTVXBpB-ghJ7ls,6228
130
130
  meerschaum/api/routes/_users.py,sha256=Gts7gltQc5uxgjfL5pQS_R-cAhkHJZJWBCKGPRS1gmQ,6809
131
131
  meerschaum/api/routes/_version.py,sha256=2t-nw_9IxCVZCNEar0LOwmut2zsClRVHjiOOUx16cu0,825
132
- meerschaum/api/routes/_webterm.py,sha256=PvYDSsNlRpGNFXqVA3MAh0E6i4SMQ3ATBQbOVNUqacw,4132
132
+ meerschaum/api/routes/_webterm.py,sha256=S7RXV8vvaTFbmVeehh4UhyXb4NCgcsyOQzoAG7jryH4,4129
133
133
  meerschaum/api/tables/__init__.py,sha256=e2aNC0CdlWICTUMx1i9RauF8Pm426J0RZJbsJWv4SWo,482
134
134
  meerschaum/config/__init__.py,sha256=5ZBq71P9t3nb74r5CGvMfNuauPscfegBX-nkaAUi5C4,11541
135
135
  meerschaum/config/_dash.py,sha256=BJHl4xMrQB-YHUEU7ldEW8q_nOPoIRSOqLrfGElc6Dw,187
@@ -144,7 +144,7 @@ meerschaum/config/_preprocess.py,sha256=-AEA8m_--KivZwTQ1sWN6LTn5sio_fUr2XZ51BO6
144
144
  meerschaum/config/_read_config.py,sha256=RLC3HHi_1ndj7ITVDKLD9_uULY3caGRwSz3ATYE-ixA,15014
145
145
  meerschaum/config/_shell.py,sha256=46_m49Txc5q1rGfCgO49ca48BODx45DQJi8D0zz1R18,4245
146
146
  meerschaum/config/_sync.py,sha256=jHcWRkxd82_BgX8Xo8agsWvf7BSbv3qHLWmYl6ehp_0,4242
147
- meerschaum/config/_version.py,sha256=xTLVpUjkTze_hdaUcpfoffXnbH-lcMVq1kPZen0twaI,71
147
+ meerschaum/config/_version.py,sha256=Zd83fipDchBm-SAFq7mGqf_u06tqRCglJ5vwS5qF1ZQ,72
148
148
  meerschaum/config/paths.py,sha256=JjibeGN3YAdSNceRwsd42aNmeUrIgM6ndzC8qZAmNI0,621
149
149
  meerschaum/config/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
150
150
  meerschaum/config/stack/__init__.py,sha256=2UukC0Lmk-aVL1o1qXzumqmuIrw3vu9fD7iCuz4XD4I,10544
@@ -152,7 +152,7 @@ meerschaum/config/stack/grafana/__init__.py,sha256=LNXQw2FvHKrD68RDhqDmi2wJjAHaK
152
152
  meerschaum/config/stack/mosquitto/__init__.py,sha256=-OwOjq8KiBoSH_pmgCAAF3Dp3CRD4KgAEdimZSadROs,186
153
153
  meerschaum/config/stack/mosquitto/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
154
154
  meerschaum/config/stack/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
155
- meerschaum/config/static/__init__.py,sha256=8GIJQzIq_gXJm7B8bJJnsT-j_IwCfF31_rYyDHUN9Qs,5394
155
+ meerschaum/config/static/__init__.py,sha256=pl2I2zj24xikCLwQox5MnFCUtI00Duje6a-1c_cuc8c,5393
156
156
  meerschaum/connectors/_Connector.py,sha256=VaVNg0SlQCTXk4shl3c68QdkbymA2Y9ScUlUjckk8PY,6795
157
157
  meerschaum/connectors/__init__.py,sha256=bpWsnU0uvoowWyUkFTwfEkadK84pssZUJ4M7yReudOU,12703
158
158
  meerschaum/connectors/parse.py,sha256=tnqzkzt_suOXYzktn_XVUrprtfym9ThijUf8HXZZlhY,4194
@@ -253,11 +253,11 @@ meerschaum/utils/packages/_packages.py,sha256=_xODMSz1FAcx3XHrn9RXUhGJ1zg-QKsVu9
253
253
  meerschaum/utils/packages/lazy_loader.py,sha256=VHnph3VozH29R4JnSSBfwtA5WKZYZQFT_GeQSShCnuc,2540
254
254
  meerschaum/utils/venv/_Venv.py,sha256=gc1TCeAj-kTZbQFAT9xl1bi4HXFV5ApT0dPOJfxwr78,3748
255
255
  meerschaum/utils/venv/__init__.py,sha256=-Mpfvz1mJ41TzVL0xKJCKOsU3nFi6XabbNiN7UbdVXs,27067
256
- meerschaum-2.7.9.dist-info/LICENSE,sha256=jG2zQEdRNt88EgHUWPpXVWmOrOduUQRx7MnYV9YIPaw,11359
257
- meerschaum-2.7.9.dist-info/METADATA,sha256=jL5sZBvdVHmo1FUDgI9InBzorrlQIqdiziqqStmaeRE,24489
258
- meerschaum-2.7.9.dist-info/NOTICE,sha256=OTA9Fcthjf5BRvWDDIcBC_xfLpeDV-RPZh3M-HQBRtQ,114
259
- meerschaum-2.7.9.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
260
- meerschaum-2.7.9.dist-info/entry_points.txt,sha256=5YBVzibw-0rNA_1VjB16z5GABsOGf-CDhW4yqH8C7Gc,88
261
- meerschaum-2.7.9.dist-info/top_level.txt,sha256=bNoSiDj0El6buocix-FRoAtJOeq1qOF5rRm2u9i7Q6A,11
262
- meerschaum-2.7.9.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
263
- meerschaum-2.7.9.dist-info/RECORD,,
256
+ meerschaum-2.7.10.dist-info/LICENSE,sha256=jG2zQEdRNt88EgHUWPpXVWmOrOduUQRx7MnYV9YIPaw,11359
257
+ meerschaum-2.7.10.dist-info/METADATA,sha256=rv1XMPgLXtrBaNTQBv-6zF_mxGdVcF5YnVacC2UGnqM,24490
258
+ meerschaum-2.7.10.dist-info/NOTICE,sha256=OTA9Fcthjf5BRvWDDIcBC_xfLpeDV-RPZh3M-HQBRtQ,114
259
+ meerschaum-2.7.10.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
260
+ meerschaum-2.7.10.dist-info/entry_points.txt,sha256=5YBVzibw-0rNA_1VjB16z5GABsOGf-CDhW4yqH8C7Gc,88
261
+ meerschaum-2.7.10.dist-info/top_level.txt,sha256=bNoSiDj0El6buocix-FRoAtJOeq1qOF5rRm2u9i7Q6A,11
262
+ meerschaum-2.7.10.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
263
+ meerschaum-2.7.10.dist-info/RECORD,,