pyntcli 0.1.102__py3-none-any.whl → 0.1.104__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,20 +1 @@
1
- __version__ = "0.1.102"
2
-
3
- try:
4
- from logzio import sender
5
- import logging
6
-
7
-
8
- def get_silent_logger():
9
- logger = logging.getLogger("silent_logger")
10
- logger.addHandler(logging.NullHandler())
11
- return logger
12
-
13
-
14
- def patched_get_stdout_logger(debug):
15
- return get_silent_logger()
16
-
17
-
18
- sender.get_stdout_logger = patched_get_stdout_logger
19
- except Exception as e:
20
- pass
1
+ __version__ = "0.1.104"
pyntcli/analytics/send.py CHANGED
@@ -1,4 +1,3 @@
1
- import requests
2
1
  import time
3
2
  import platform
4
3
  import socket
@@ -7,7 +6,6 @@ import subprocess
7
6
  from pyntcli import __version__
8
7
  from pyntcli.transport import pynt_requests
9
8
  import pyntcli.log.log as log
10
- from pyntcli.ui import ui_thread
11
9
 
12
10
 
13
11
  PYNT_DEFAULT_USER_ID = "d9e3b82b-2900-43bf-8c8f-7ffe2f0cda36"
@@ -95,7 +93,7 @@ class AnalyticsSender():
95
93
 
96
94
  if self.user_id != PYNT_DEFAULT_USER_ID:
97
95
  if self.disable_analytics:
98
- logger.info(f"Analytics disabled, sending to logz: {base_event}")
96
+ logger.info(f"Analytics disabled, not sending: {base_event}")
99
97
  else:
100
98
  pynt_requests.post(MIXPANEL_URL, json=[base_event])
101
99
  else:
@@ -117,10 +115,7 @@ class AnalyticsSender():
117
115
  self.done()
118
116
 
119
117
  def done(self):
120
- if self.events:
121
- if self.disable_analytics:
122
- logger.info(f"Analytics disabled, sending to logz: {self.events}")
123
- else:
124
- pynt_requests.post(MIXPANEL_URL, json=self.events)
118
+ if self.events and not self.disable_analytics:
119
+ pynt_requests.post(MIXPANEL_URL, json=self.events)
125
120
 
126
- self.events = []
121
+ self.events = []
@@ -98,7 +98,7 @@ class PostmanSubCommand(sub_command.PyntSubCommand):
98
98
  container_config = pynt_container.DockerContainerConfig(
99
99
  args,
100
100
  "postman",
101
- pynt_container.PyntDockerPort(src=PYNT_CONTAINER_INTERNAL_PORT, port=args.port, name="--port"))
101
+ pynt_container.PyntDockerPort(src=PYNT_CONTAINER_INTERNAL_PORT, dest=args.port, name="--port"))
102
102
 
103
103
  postman_docker = pynt_container.PyntContainerNative(container_config)
104
104
  postman_docker.prepare_client()
pyntcli/commands/root.py CHANGED
@@ -2,7 +2,6 @@ import argparse
2
2
  from os import environ
3
3
 
4
4
  from pyntcli.auth import login
5
- import pyntcli.log.log as log
6
5
  from pyntcli.ui import ui_thread
7
6
  from pyntcli.analytics import send as analytics
8
7
 
@@ -116,6 +115,5 @@ class BaseCommand:
116
115
  user_id = login.user_id()
117
116
  if user_id:
118
117
  analytics.set_user_id(user_id)
119
- log.add_user_details(user_id)
120
118
 
121
119
  check_cicd_context()
pyntcli/log/log.py CHANGED
@@ -1,46 +1,7 @@
1
- import os
2
1
  import logging
3
2
  import logging.config
4
- from contextlib import contextmanager
5
- from logzio.handler import ExtraFieldsLogFilter
6
3
 
7
- loggerType = logging.Logger
8
-
9
- LOGGING = {
10
- 'version': 1,
11
- 'disable_existing_loggers': False,
12
- 'handlers': {
13
- 'logzio': {
14
- 'class': 'logzio.handler.LogzioHandler',
15
- 'level': 'DEBUG',
16
- 'token': "KOfjdWTcZXmjAwAOslpFYwhLpDzFTfJl",
17
- 'logs_drain_timeout': 5,
18
- 'url': 'https://listener.logz.io:8071',
19
- 'retries_no': 1,
20
- }
21
- },
22
- 'loggers': {
23
- 'logzioLogger': {
24
- 'level': 'DEBUG',
25
- 'handlers': ['logzio'],
26
- 'propagate': True
27
- },
28
-
29
- }
30
- }
31
-
32
- logging.config.dictConfig(LOGGING)
33
-
34
- logger = logging.getLogger('logzioLogger')
35
-
36
- def set_source(version):
37
- logger.addFilter(ExtraFieldsLogFilter({"source":{"pyntcli":version}}))
38
-
39
- def add_user_details(id):
40
- logger.addFilter(ExtraFieldsLogFilter({"userId":id}))
41
-
42
- def flush_logger():
43
- [h.flush() for h in logger.handlers]
4
+ logger = logging.getLogger(__name__)
44
5
 
45
6
  def get_logger():
46
7
  return logger
pyntcli/main.py CHANGED
@@ -1,7 +1,6 @@
1
1
  from sys import argv, exit
2
2
  import signal
3
3
  import os
4
- import pyntcli.log.log as log
5
4
  from pyntcli.commands import pynt_cmd
6
5
  from pyntcli.pynt_docker import pynt_container
7
6
  from pyntcli.ui import ui_thread
@@ -41,7 +40,6 @@ def print_header():
41
40
  def start_analytics(user_id: str):
42
41
  if user_id:
43
42
  analytics.set_user_id(user_id)
44
- log.add_user_details(user_id)
45
43
 
46
44
 
47
45
  def logout():
@@ -71,7 +69,6 @@ def main():
71
69
  if "--verbose" in argv:
72
70
  ui_thread.VERBOSE = True
73
71
 
74
- log.set_source(__version__)
75
72
  ui_thread.print_verbose("Logging in...")
76
73
  user_id = login.user_id()
77
74
  start_analytics(user_id)
@@ -126,7 +123,6 @@ def main():
126
123
  pynt_errors.unexpected_error(e)
127
124
 
128
125
  finally:
129
- log.flush_logger()
130
126
  shutdown_cli()
131
127
 
132
128
 
@@ -3,6 +3,7 @@ import subprocess
3
3
  import os
4
4
  import json
5
5
  import argparse
6
+ import threading
6
7
  from typing import List
7
8
  import base64
8
9
 
@@ -260,16 +261,28 @@ class PyntContainerNative:
260
261
  if process.returncode and process.returncode != 0:
261
262
  raise DockerNativeUnavailableException(f"Unable to perform docker run command, return code: {process.returncode}")
262
263
 
264
+ # Start log streaming in a separate thread
265
+ if ui_thread.VERBOSE:
266
+ log_thread = threading.Thread(target=self.stream_docker_logs, args=(container_id,))
267
+ log_thread.daemon = True
268
+ log_thread.start()
269
+
270
+ def stream_docker_logs(self, container_id):
263
271
  logs_process = subprocess.Popen(
264
- ['docker', 'logs', container_id],
272
+ ['docker', 'logs', '-f', container_id],
265
273
  stdout=subprocess.PIPE,
266
274
  stderr=subprocess.PIPE,
267
275
  text=True
268
276
  )
269
277
 
270
- logs_stdout, logs_stderr = logs_process.communicate()
278
+ while True:
279
+ log_output = logs_process.stdout.readline()
280
+ if log_output == '' and logs_process.poll() is not None:
281
+ break
282
+ if log_output:
283
+ print(log_output.strip())
271
284
 
272
- self.stdout = logs_stdout
285
+ logs_process.stdout.close()
273
286
 
274
287
  def kill_other_instances(self, report_to_user=True):
275
288
  ui_thread.print_verbose("Killing other pynt containers if such exist")
@@ -283,7 +296,7 @@ class PyntContainerNative:
283
296
  container_ids = containers_output.splitlines()
284
297
  for container_id in container_ids:
285
298
  command = ["docker", "kill", container_id]
286
- subprocess.run(command)
299
+ subprocess.run(command,stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
287
300
  if report_to_user:
288
301
  ui_thread.print(
289
302
  ui_thread.PrinterText("Another Pynt container was running, killed it", ui_thread.PrinterText))
@@ -1,15 +1,14 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyntcli
3
- Version: 0.1.102
3
+ Version: 0.1.104
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
7
- Requires-Python: >=3.7
7
+ Requires-Python: >=3.9
8
8
  Requires-Dist: rich
9
9
  Requires-Dist: requests==2.31.0
10
10
  Requires-Dist: pem
11
11
  Requires-Dist: certifi>=2017.4.17
12
- Requires-Dist: logzio-python-handler>=4.1.0
13
12
  Requires-Dist: websocket-client
14
13
  Requires-Dist: xmltodict
15
14
  Requires-Dist: timedinput==0.1.1
@@ -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=FOqUO2NVzyu71qVPUvSdcSq0R9nb3HWrEn0eMrsEMO8,403
5
- pyntcli/main.py,sha256=WEbWyqzDjtnZGSWgqru1FCT7wmHdi11uzd1LmwTTCI4,6095
4
+ pyntcli/__init__.py,sha256=Vjjs1BYAO1INJZawED5BdBMAeebPcKzlvATnfl-mpRw,24
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=9TRAEoPbv4rWOZfcNaGanrRJAFvNs39P-uKSl49GcQE,3679
7
+ pyntcli/analytics/send.py,sha256=U8F2qh1CYZCTb-reEvPXWVPrGkb3bnHc1I6fBWnG_2U,3509
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
@@ -14,17 +14,17 @@ pyntcli/commands/har.py,sha256=NzxyXlgS5YtQJqi9528V0FkbonMaZ0wHuvRl0LmR5JA,4329
14
14
  pyntcli/commands/id_command.py,sha256=UBEgMIpm4vauTCsKyixltiGUolNg_OfHEJvJ_i5BpJY,943
15
15
  pyntcli/commands/listen.py,sha256=oxgMvJYpPEu6h8qRFoueGF3a_nmwzaWMPL8ucfy7yxE,8983
16
16
  pyntcli/commands/newman.py,sha256=PRbsbDTxL54FRVYOYEpKJ5icVdGXtG2bfiGsnJgmKT4,5173
17
- pyntcli/commands/postman.py,sha256=aStkkyx3FTXvnIcQxNf1_OPKDE1RL25OALc2eyAZJCY,4980
17
+ pyntcli/commands/postman.py,sha256=gV7Y_NM6oUQl1b7mLiGKnzityCuCE9RYMLFfeHFD-Gc,4980
18
18
  pyntcli/commands/pynt_cmd.py,sha256=T7jee0yw67Zth3lTkSDInCLnbu_IhpNqb7GqnTiTceQ,7012
19
- pyntcli/commands/root.py,sha256=6dSzKSjUX-ZetE2KYJNkBmfDDrcYJligmHBqIAIc2aQ,4140
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
22
  pyntcli/commands/util.py,sha256=csZHQ2Xbdh-_KX-yIVrnaeNsT0NbuS-ej6kND3CxD_w,4414
23
23
  pyntcli/log/__init__.py,sha256=cOGwOYzMoshEbZiiasBGkj6wF0SBu3Jdpl-AuakDesw,19
24
- pyntcli/log/log.py,sha256=cWCdWmUaAwePwdhYDcgNMEG9d9RM34sGahxBCYEdv2Y,1069
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=Yl_YESabRmWb38roDDUa_r3NKeAiwa0h9TPY7zTIsfY,13303
27
+ pyntcli/pynt_docker/pynt_container.py,sha256=AnfIPwu0NVTBH4_9F1pjJb9oIietebOBTzJ8ssNf-ro,13849
28
28
  pyntcli/store/__init__.py,sha256=1fP8cEAQCF_myja3gnhHH9FEqtBiOJ-2aBmUXSKBdFA,41
29
29
  pyntcli/store/json_connector.py,sha256=UGs3uORw3iyn0YJ8kzab-veEZToA6d-ByXYuqEleWsA,560
30
30
  pyntcli/store/store.py,sha256=ZLSe0WAjHDp8cSt4BBFDkPGRux4cgOo5UfF7V4naM7U,2559
@@ -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.102.dist-info/METADATA,sha256=hC0ph5yb-J8gVgy9CKsVxj6s5UR80btfQdehYhTT_e0,472
43
- pyntcli-0.1.102.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
44
- pyntcli-0.1.102.dist-info/entry_points.txt,sha256=kcGmqAxXDttNk2EPRcqunc_LTVp61gzakz0v-GEE2SY,43
45
- pyntcli-0.1.102.dist-info/top_level.txt,sha256=64XSgBzSpgwjYjEKHZE7q3JH2a816zEeyZBXfJi3AKI,42
46
- pyntcli-0.1.102.dist-info/RECORD,,
42
+ pyntcli-0.1.104.dist-info/METADATA,sha256=ie6Wx72JdfutnaFdNYOyfYp48n45Y7nFPyREUb1M6SA,428
43
+ pyntcli-0.1.104.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
44
+ pyntcli-0.1.104.dist-info/entry_points.txt,sha256=kcGmqAxXDttNk2EPRcqunc_LTVp61gzakz0v-GEE2SY,43
45
+ pyntcli-0.1.104.dist-info/top_level.txt,sha256=64XSgBzSpgwjYjEKHZE7q3JH2a816zEeyZBXfJi3AKI,42
46
+ pyntcli-0.1.104.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (75.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5