pyntcli 0.1.60__py3-none-any.whl → 0.1.62__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.60"
1
+ __version__ = "0.1.62"
pyntcli/analytics/send.py CHANGED
@@ -24,6 +24,7 @@ def set_user_id(user_id):
24
24
  CLI_START = "cli_start"
25
25
  LOGIN_START = "cli_login_start"
26
26
  LOGIN_DONE = "cli_login_done"
27
+ CICD = "CI/CD"
27
28
  ERROR = "error"
28
29
 
29
30
  class AnalyticsSender():
pyntcli/auth/login.py CHANGED
@@ -21,7 +21,7 @@ class InvalidTokenInEnvVarsException(LoginException):
21
21
  pass
22
22
 
23
23
  PYNT_CREDENTIALS = "PYNT_CREDENTIALS"
24
- PYNT_SAAS = "PYNT_SAAS_URL"
24
+ PYNT_SAAS = os.environ.get("PYNT_SAAS_URL") if os.environ.get("PYNT_SAAS_URL") else "https://api.pynt.io/v1"
25
25
 
26
26
  class Login():
27
27
  def __init__(self) -> None:
@@ -60,9 +60,7 @@ class Login():
60
60
 
61
61
 
62
62
  def refresh_request(refresh_token):
63
- if os.environ.get(PYNT_SAAS):
64
- return pynt_requests.post(os.environ[PYNT_SAAS] + "/auth/refresh", json={"refresh_token": refresh_token})
65
- return pynt_requests.post("https://auth.pynt.io/default/refresh", json={"refresh_token": refresh_token})
63
+ return pynt_requests.post(PYNT_SAAS + "/auth/refresh", json={"refresh_token": refresh_token})
66
64
 
67
65
  def refresh_token():
68
66
  token = None
pyntcli/commands/root.py CHANGED
@@ -1,6 +1,8 @@
1
1
  import argparse
2
2
  import sys
3
3
 
4
+ from os import environ
5
+
4
6
  from pyntcli.auth import login
5
7
  from pyntcli.ui import ui_thread
6
8
  from pyntcli.analytics import send as analytics
@@ -19,6 +21,18 @@ def root_usage():
19
21
  def usage(*args):
20
22
  ui_thread.print(root_usage())
21
23
 
24
+
25
+ def check_cicd_context():
26
+ if environ.get('GITHUB_ACTION') is not None:
27
+ analytics.emit(analytics.CICD, {"env": "GitHub"})
28
+ return
29
+ if environ.get('GITLAB_USER_ID') is not None:
30
+ analytics.emit(analytics.CICD, {"env": "GitLab"})
31
+ return
32
+ if environ.get('JENKINS_HOME') is not None:
33
+ analytics.emit(analytics.CICD, {"env": "Jenkins"})
34
+
35
+
22
36
  class BaseCommand():
23
37
  def __init__(self) -> None:
24
38
  self.base: argparse.ArgumentParser = None
@@ -57,3 +71,5 @@ class BaseCommand():
57
71
  user_id = login.user_id()
58
72
  if user_id:
59
73
  analytics.set_user_id(user_id)
74
+
75
+ check_cicd_context()
@@ -79,10 +79,7 @@ def get_container_with_arguments(args: argparse.Namespace , *port_args: PyntDock
79
79
  docker_arguments += ["--host-ca", ca_name]
80
80
  mounts.append(create_mount(os.path.abspath(args.host_ca), "/etc/pynt/{}".format(ca_name)))
81
81
 
82
- env = {PYNT_CREDENTIALS:CredStore().get_access_token()}
83
-
84
- if os.environ.get(PYNT_SAAS):
85
- env.update({PYNT_SAAS: os.environ[PYNT_SAAS]})
82
+ env = {PYNT_CREDENTIALS:CredStore().get_access_token(), "PYNT_SAAS_URL": PYNT_SAAS}
86
83
 
87
84
  return PyntBaseConatiner(docker_type, docker_arguments, mounts, env)
88
85
 
@@ -171,6 +168,7 @@ class PyntContainer():
171
168
  ui_thread.print(ui_thread.PrinterText("Docker pull done", ui_thread.PrinterText.INFO))
172
169
 
173
170
  args = self.base_container.docker_arguments if self.base_container.docker_arguments else None
171
+
174
172
 
175
173
  run_arguments = {
176
174
  "image":image,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyntcli
3
- Version: 0.1.60
3
+ Version: 0.1.62
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,9 +1,9 @@
1
- pyntcli/__init__.py,sha256=SH6dBtwKkjChke7DXHi0Y5HbtzV16-5wAfhv91d_D0A,23
1
+ pyntcli/__init__.py,sha256=cwSKWX9cG1qs0I6C99TSkty5QpTa10uiqSeiXnsoOg0,23
2
2
  pyntcli/main.py,sha256=MmciZ-oE1_1Q0PUbMb1MUAesXlIxG5PqD43LCKY6I1U,3607
3
3
  pyntcli/analytics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- pyntcli/analytics/send.py,sha256=hHoMorH3bmY0oXHDQac1JJAAN05BjDHaY7p0WmKg4Z4,2095
4
+ pyntcli/analytics/send.py,sha256=tfRsXlwABk_el1snDrxJ-XKiMQu08MmIwj2cIAaf5mI,2110
5
5
  pyntcli/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- pyntcli/auth/login.py,sha256=kUDrmnKyfhiGgRgwZoNrmla5v4ELBCr7lFyEkSP5IGE,4918
6
+ pyntcli/auth/login.py,sha256=P5CoIf72V1rWAIBp5UGUuCAtEUweEjyoztF-PCBYGPM,4839
7
7
  pyntcli/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  pyntcli/commands/har.py,sha256=s5TUw9JVhINRa1kaU6d784u6k_UAMcYu8ZzLk9W6JG4,2935
9
9
  pyntcli/commands/id_command.py,sha256=2J5oEa39uyBMMSCRHzuKh3_11CeUEYi7YLoBk1yuu_I,942
@@ -11,11 +11,11 @@ pyntcli/commands/newman.py,sha256=7u6N12IrJZeLXOTTz7JE8qBXPWNmGFxHmGlY_gE_zGM,41
11
11
  pyntcli/commands/postman.py,sha256=kuEBsxQ0chbsify5MQOJjKYZToDaxxXfGLGb446MFs4,2522
12
12
  pyntcli/commands/proxy.py,sha256=kyhgtpB9zrbMa_lpg0q8uLdZJ4MqLZfqyxumoaqiK3w,7861
13
13
  pyntcli/commands/pynt_cmd.py,sha256=JjOHrJs5S9iPtg272zBr04e7uKsO0IdSLaA5wpSg888,2406
14
- pyntcli/commands/root.py,sha256=n0v8LhlKJcuzr4r1aRhHLlpe9aLngUH0gquItaTnkMQ,2252
14
+ pyntcli/commands/root.py,sha256=leN3gFCHrSH4XLemZt2oycwVfffQMuF0Ocr-5wAWI24,2690
15
15
  pyntcli/commands/sub_command.py,sha256=GF3-rE_qk2L4jGPFqHLm9SdGINmu3EakhjJTFyWjRms,374
16
16
  pyntcli/commands/util.py,sha256=txcrmZvFH-xGImbUMPfsYNbRbuZpDkKNK76STiqCEcs,2893
17
17
  pyntcli/pynt_docker/__init__.py,sha256=PQIOVxc7XXtMLfEX7ojgwf_Z3mmTllO3ZvzUZTPOxQY,30
18
- pyntcli/pynt_docker/pynt_container.py,sha256=rpyIOL6PPxUeOdcnVmT1k12Ug-FL9AZh1TZT8W41Oxk,7314
18
+ pyntcli/pynt_docker/pynt_container.py,sha256=5FuZ05g4WtYAxfaZdRLEjquTJaY4LFZLU9HGKEssESM,7260
19
19
  pyntcli/store/__init__.py,sha256=xuS9OB21F6B1sUx5XPGxz_6WpG6-KTMbuq50RrZS5OY,29
20
20
  pyntcli/store/json_connector.py,sha256=UGs3uORw3iyn0YJ8kzab-veEZToA6d-ByXYuqEleWsA,560
21
21
  pyntcli/store/store.py,sha256=Fbc7yxjht0EJ89eGF8eMgNQJ3sgYRTPmj2-sWQ5UUPs,1766
@@ -30,8 +30,8 @@ pyntcli/ui/ui_thread.py,sha256=JAonXc6aOFawaEixghclxHSCHZBieEWfZzsPef_ZNMI,4796
30
30
  tests/conftest.py,sha256=gToq5K74GtgeGQXjFvXSzMaE6axBYxAzcFG5XJPOXjI,427
31
31
  tests/auth/test_login.py,sha256=M6JRFTQRZrL6M2-iph_r-aBSQMMiFDncQbVYeObBFYU,3296
32
32
  tests/store/test_cred_store.py,sha256=_7-917EtNC9eKEumO2_lt-7KuDmCwOZFaowCm7DbA_A,254
33
- pyntcli-0.1.60.dist-info/METADATA,sha256=sjEU_0zk4NvJFkvjzLxQ3dQv052Ul2OQnFcS-awBwV0,361
34
- pyntcli-0.1.60.dist-info/WHEEL,sha256=5sUXSg9e4bi7lTLOHcm6QEYwO5TIF1TNbTSVFVjcJcc,92
35
- pyntcli-0.1.60.dist-info/entry_points.txt,sha256=kcGmqAxXDttNk2EPRcqunc_LTVp61gzakz0v-GEE2SY,43
36
- pyntcli-0.1.60.dist-info/top_level.txt,sha256=u9MDStwVHB7UG8PUcODeWCul_NvzL2EzoLvSlgwLHFs,30
37
- pyntcli-0.1.60.dist-info/RECORD,,
33
+ pyntcli-0.1.62.dist-info/METADATA,sha256=1cs1VO2XZ4kOHvA4UQbgSgK3rawfJRHDUomMrcMtD5w,361
34
+ pyntcli-0.1.62.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
35
+ pyntcli-0.1.62.dist-info/entry_points.txt,sha256=kcGmqAxXDttNk2EPRcqunc_LTVp61gzakz0v-GEE2SY,43
36
+ pyntcli-0.1.62.dist-info/top_level.txt,sha256=u9MDStwVHB7UG8PUcODeWCul_NvzL2EzoLvSlgwLHFs,30
37
+ pyntcli-0.1.62.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.1)
2
+ Generator: bdist_wheel (0.41.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5