pyntcli 0.1.105__py3-none-any.whl → 0.1.107__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.
pyntcli/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.1.105"
1
+ __version__ = "0.1.107"
pyntcli/analytics/send.py CHANGED
@@ -95,7 +95,11 @@ class AnalyticsSender():
95
95
  if self.disable_analytics:
96
96
  logger.info(f"Analytics disabled, not sending: {base_event}")
97
97
  else:
98
- pynt_requests.post(MIXPANEL_URL, json=[base_event])
98
+ try:
99
+ pynt_requests.post(MIXPANEL_URL, json=[base_event])
100
+ except Exception as e:
101
+ logger.error(f"Failed to send analytics event: {base_event}, error: {e}")
102
+ pass
99
103
  else:
100
104
  self.events.append(base_event)
101
105
 
@@ -116,6 +120,10 @@ class AnalyticsSender():
116
120
 
117
121
  def done(self):
118
122
  if self.events and not self.disable_analytics:
119
- pynt_requests.post(MIXPANEL_URL, json=self.events)
123
+ try:
124
+ pynt_requests.post(MIXPANEL_URL, json=self.events)
125
+ except Exception as e:
126
+ logger.error(f"Failed to send analytics events. error: {e}")
127
+ pass
120
128
 
121
129
  self.events = []
pyntcli/commands/util.py CHANGED
@@ -1,12 +1,12 @@
1
1
  import time
2
2
  import socket
3
3
  import os
4
- import tempfile
5
4
  from contextlib import contextmanager
6
5
  from pathlib import Path
7
6
  import webbrowser
8
7
  import json
9
8
  import pyntcli.log.log as log
9
+ import pyntcli.store.store as store
10
10
 
11
11
  from pyntcli.commands.static_file_extensions import STATIC_FILE_EXTENSIONS
12
12
  from pyntcli.pynt_docker import pynt_container
@@ -74,8 +74,8 @@ class SeverityException(Exception):
74
74
 
75
75
  @contextmanager
76
76
  def create_default_file_mounts(args):
77
- html_report_path = os.path.join(tempfile.gettempdir(), "results.html")
78
- json_report_path = os.path.join(tempfile.gettempdir(), "results.json")
77
+ html_report_path = os.path.join(store.get_default_store_dir(), "results.html")
78
+ json_report_path = os.path.join(store.get_default_store_dir(), "results.json")
79
79
 
80
80
  if "reporters" in args and args.reporters:
81
81
  html_report_path = os.path.join(os.getcwd(), "pynt_results.html")
@@ -288,15 +288,17 @@ class PyntContainerNative:
288
288
  ui_thread.print_verbose("Killing other pynt containers if such exist")
289
289
  try:
290
290
  for _ in IMAGE_TAGS:
291
- command = ["docker", "ps", "-q", "-f", f"name={self.container_name}"]
291
+ command = ["docker", "ps", "-a", "-q", "-f", f"name={self.container_name}"]
292
292
  containers_output = subprocess.check_output(command, text=True)
293
293
  if not containers_output:
294
294
  continue
295
295
 
296
296
  container_ids = containers_output.splitlines()
297
297
  for container_id in container_ids:
298
- command = ["docker", "kill", container_id]
299
- subprocess.run(command,stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
298
+ kill_command = ["docker", "kill", container_id]
299
+ remove_command = ["docker", "remove", container_id]
300
+ subprocess.run(kill_command,stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
301
+ subprocess.run(remove_command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
300
302
  if report_to_user:
301
303
  ui_thread.print(
302
304
  ui_thread.PrinterText("Another Pynt container was running, killed it", ui_thread.PrinterText))
pyntcli/store/store.py CHANGED
@@ -5,6 +5,10 @@ from .json_connector import JsonStoreConnector
5
5
  from .store_connector import StoreConnector
6
6
 
7
7
 
8
+ def get_default_store_dir():
9
+ return os.path.join(os.path.expanduser("~"), ".pynt")
10
+
11
+
8
12
  class Store():
9
13
  def __init__(self, file_location: str, connector_type: Type[StoreConnector]) -> None:
10
14
  self.file_location = file_location
@@ -40,9 +44,6 @@ class Store():
40
44
  def get_path(self):
41
45
  return self.file_location
42
46
 
43
- def _get_default_store_dir(self):
44
- return os.path.join(os.path.expanduser("~"), ".pynt")
45
-
46
47
  def __enter__(self):
47
48
  self._get_file_data()
48
49
  return self
@@ -54,7 +55,7 @@ class Store():
54
55
 
55
56
  class CredStore(Store):
56
57
  def __init__(self) -> None:
57
- pynt_dir = super()._get_default_store_dir()
58
+ pynt_dir = get_default_store_dir()
58
59
  super().__init__(file_location=os.path.join(pynt_dir, "creds.json"),
59
60
  connector_type=JsonStoreConnector)
60
61
 
@@ -73,7 +74,7 @@ class CredStore(Store):
73
74
 
74
75
  class StateStore(Store):
75
76
  def __init__(self) -> None:
76
- pynt_dir = super()._get_default_store_dir()
77
+ pynt_dir = get_default_store_dir()
77
78
  super().__init__(file_location=os.path.join(pynt_dir, "state.json"),
78
79
  connector_type=JsonStoreConnector)
79
80
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyntcli
3
- Version: 0.1.105
3
+ Version: 0.1.107
4
4
  Summary: Command line utility to handle all of Pynt's different integrations
5
5
  Author-email: Pynt-io <support@pynt.io>
6
6
  Project-URL: Homepage, https://pynt.io
@@ -1,10 +1,10 @@
1
1
  ignoreTests/conftest.py,sha256=gToq5K74GtgeGQXjFvXSzMaE6axBYxAzcFG5XJPOXjI,427
2
2
  ignoreTests/auth/login.py,sha256=KFlzWhXBAuwdi7GXf16gCB3ya94LQG2wjcSChE149rQ,3798
3
3
  ignoreTests/store/cred_store.py,sha256=_7-917EtNC9eKEumO2_lt-7KuDmCwOZFaowCm7DbA_A,254
4
- pyntcli/__init__.py,sha256=HgBBYnefIIbQJYRCDzUrV1XShKQixe48kLei7iJcsSs,24
4
+ pyntcli/__init__.py,sha256=EOCfjhl8tpnOQpcbCZSBKM0i_FvcprayX3DIVt2CxZY,24
5
5
  pyntcli/main.py,sha256=RD0W2_0ogYBCXubo-YewxHYkiIXxNv6NkZOh3n1VujE,5964
6
6
  pyntcli/analytics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- pyntcli/analytics/send.py,sha256=U8F2qh1CYZCTb-reEvPXWVPrGkb3bnHc1I6fBWnG_2U,3509
7
+ pyntcli/analytics/send.py,sha256=0hJ0WJNFHLqyohtRr_xOg5WEXzxHrUOlcePPg-k65Hk,3846
8
8
  pyntcli/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  pyntcli/auth/login.py,sha256=TljsRXbEkNI1YUrKm5mlTw4YiecYScYUsit8Z8vstss,5228
10
10
  pyntcli/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -19,15 +19,15 @@ pyntcli/commands/pynt_cmd.py,sha256=T7jee0yw67Zth3lTkSDInCLnbu_IhpNqb7GqnTiTceQ,
19
19
  pyntcli/commands/root.py,sha256=UtGky7LfbfQ6mELHoNJcdHznFrUVBlhXI47_8QdApfc,4068
20
20
  pyntcli/commands/static_file_extensions.py,sha256=PZJb02BI-64tbU-j3rdCNsXzTh7gkIDGxGKbKNw3h5k,1995
21
21
  pyntcli/commands/sub_command.py,sha256=GF3-rE_qk2L4jGPFqHLm9SdGINmu3EakhjJTFyWjRms,374
22
- pyntcli/commands/util.py,sha256=csZHQ2Xbdh-_KX-yIVrnaeNsT0NbuS-ej6kND3CxD_w,4414
22
+ pyntcli/commands/util.py,sha256=FGtuXLxMAL0b9sbsrJaQR_-5sEu-PwZOJonMwuCjO2U,4450
23
23
  pyntcli/log/__init__.py,sha256=cOGwOYzMoshEbZiiasBGkj6wF0SBu3Jdpl-AuakDesw,19
24
24
  pyntcli/log/log.py,sha256=YXCvcCzuhQ5QUT2L02uQEdN_lTCzLEuet4OnLuEnjlM,112
25
25
  pyntcli/pynt_docker/__init__.py,sha256=PQIOVxc7XXtMLfEX7ojgwf_Z3mmTllO3ZvzUZTPOxQY,30
26
26
  pyntcli/pynt_docker/container_utils.py,sha256=_Onn7loInzyJAG2-Uk6CGpsuRyelmUFHOvtJj4Uzi9A,175
27
- pyntcli/pynt_docker/pynt_container.py,sha256=AnfIPwu0NVTBH4_9F1pjJb9oIietebOBTzJ8ssNf-ro,13849
27
+ pyntcli/pynt_docker/pynt_container.py,sha256=oItp-NK4eu08DfpTtyBXrjHOE7jHZjffwe8Ox9ae770,14042
28
28
  pyntcli/store/__init__.py,sha256=1fP8cEAQCF_myja3gnhHH9FEqtBiOJ-2aBmUXSKBdFA,41
29
29
  pyntcli/store/json_connector.py,sha256=UGs3uORw3iyn0YJ8kzab-veEZToA6d-ByXYuqEleWsA,560
30
- pyntcli/store/store.py,sha256=ZLSe0WAjHDp8cSt4BBFDkPGRux4cgOo5UfF7V4naM7U,2559
30
+ pyntcli/store/store.py,sha256=Kl_HT9FJFdKlAH7SwAt3g4-bW-r-1ve_u13OPggQai0,2529
31
31
  pyntcli/store/store_connector.py,sha256=w4LzcpRZesUZL1f63RmLlWEFRtJ6Y6rcS6PkkGtO4MA,357
32
32
  pyntcli/transport/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  pyntcli/transport/pynt_requests.py,sha256=C7OPvcKkRTcxSYuyiWKE59KgA9sRX0d6fm1wnopAmPo,1719
@@ -39,8 +39,8 @@ pyntcli/ui/report.py,sha256=W-icPSZrGLOubXgam0LpOvHLl_aZg9Zx9qIkL8Ym5PE,1930
39
39
  pyntcli/ui/ui_thread.py,sha256=XUBgLpYQjVhrilU-ofw7VSXgTiwneSdTxm61EvC3x4Q,5091
40
40
  tests/test_utils.py,sha256=t5fTQUk1U_Js6iMxcGYGqt4C-crzOJ0CqCKtLkRtUi0,2050
41
41
  tests/commands/test_pynt_cmd.py,sha256=BjGFCFACcSziLrNA6_27t6TjSmvdu54wx9njwLpRSJY,8379
42
- pyntcli-0.1.105.dist-info/METADATA,sha256=fY5Wj4fgESMah0UVLqBzixfK_F32VARFLgmodPMsat8,428
43
- pyntcli-0.1.105.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
44
- pyntcli-0.1.105.dist-info/entry_points.txt,sha256=kcGmqAxXDttNk2EPRcqunc_LTVp61gzakz0v-GEE2SY,43
45
- pyntcli-0.1.105.dist-info/top_level.txt,sha256=64XSgBzSpgwjYjEKHZE7q3JH2a816zEeyZBXfJi3AKI,42
46
- pyntcli-0.1.105.dist-info/RECORD,,
42
+ pyntcli-0.1.107.dist-info/METADATA,sha256=IntbbJxOYoQBlP7_awa0DmVxHubkTuY67D5buGUn5HA,428
43
+ pyntcli-0.1.107.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
44
+ pyntcli-0.1.107.dist-info/entry_points.txt,sha256=kcGmqAxXDttNk2EPRcqunc_LTVp61gzakz0v-GEE2SY,43
45
+ pyntcli-0.1.107.dist-info/top_level.txt,sha256=64XSgBzSpgwjYjEKHZE7q3JH2a816zEeyZBXfJi3AKI,42
46
+ pyntcli-0.1.107.dist-info/RECORD,,