algosec-appviz 0.0.5__py3-none-any.whl → 0.0.6__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.
algosec_appviz/main.py CHANGED
@@ -14,12 +14,13 @@ regions = {
14
14
 
15
15
 
16
16
  class AppViz:
17
- def __init__(self, region='eu', tenant_id=None, client_id=None, client_secret=None):
17
+ def __init__(self, region='eu', tenant_id=None, client_id=None, client_secret=None, proxies=None):
18
18
  if region not in regions.keys():
19
19
  raise ValueError(f"Invalid region, must be one of: {', '.join(regions.keys())}")
20
20
 
21
- login_url = f"https://{regions[region]}/api/algosaas/auth/v1/access-keys/login"
21
+ self.proxies = proxies
22
22
 
23
+ login_url = f"https://{regions[region]}/api/algosaas/auth/v1/access-keys/login"
23
24
  data = {
24
25
  "tenantId": tenant_id or environment.get_tenant_id(),
25
26
  "clientId": client_id or environment.get_client_id(),
@@ -34,6 +35,7 @@ class AppViz:
34
35
  response = requests.post(login_url, json=data, headers=headers)
35
36
  if response.status_code != 200:
36
37
  raise ConnectionError(f"Authentication to AppViz failed: {response.text}")
38
+
37
39
  self.url = 'https://' + regions[region]
38
40
  self._token_type = response.json()['token_type']
39
41
  self._token = response.json()['access_token']
@@ -48,8 +50,8 @@ class AppViz:
48
50
  }
49
51
 
50
52
  result = self._make_api_call('POST',
51
- '/BusinessFlow/rest/v1/applications/new',
52
- body=body)
53
+ '/BusinessFlow/rest/v1/applications/new',
54
+ body=body)
53
55
 
54
56
  return result
55
57
 
@@ -102,11 +104,14 @@ class AppViz:
102
104
  'Authorization': f'{self._token_type} {self._token}'
103
105
  }
104
106
 
107
+ url = self.url + url_path
108
+
105
109
  if method.lower() == 'get':
106
- response = requests.get(self.url + url_path, headers=headers, json=body, params=params)
110
+ response = requests.get(url, headers=headers, json=body, params=params, proxies=self.proxies)
107
111
  elif method.lower() == 'post':
108
- response = requests.post(self.url + url_path, headers=headers, json=body, params=params)
112
+ response = requests.post(url, headers=headers, json=body, params=params, proxies=self.proxies)
109
113
  else:
110
114
  raise ValueError("Invalid method, must be: 'GET' or 'POST'")
111
115
 
116
+ response.raise_for_status()
112
117
  return response.json()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: algosec_appviz
3
- Version: 0.0.5
3
+ Version: 0.0.6
4
4
  Summary: AlgoSec AppViz Library
5
5
  Home-page: https://github.com/bogdan-iot/algosec-appviz
6
6
  License: LICENSE
@@ -0,0 +1,7 @@
1
+ algosec_appviz/__init__.py,sha256=epwLWpezNwfYP0Zuqk32rWEvNeloAKzbrRFi9tzlsXo,46
2
+ algosec_appviz/environment.py,sha256=ycrVSpR6oLpj9p54SvDdy0nqwS9IwHAh-1x-zOaTQ5I,1775
3
+ algosec_appviz/main.py,sha256=2WCC6PaCaeUF6HTRjE_EoFCj7k1R0AngXsbCOmGww4c,4153
4
+ algosec_appviz-0.0.6.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
5
+ algosec_appviz-0.0.6.dist-info/METADATA,sha256=yq6_qrQYtflqYsvWv5nG-iLswU5VGf6Ym3xnZNRMKDw,1798
6
+ algosec_appviz-0.0.6.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
7
+ algosec_appviz-0.0.6.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- algosec_appviz/__init__.py,sha256=epwLWpezNwfYP0Zuqk32rWEvNeloAKzbrRFi9tzlsXo,46
2
- algosec_appviz/environment.py,sha256=ycrVSpR6oLpj9p54SvDdy0nqwS9IwHAh-1x-zOaTQ5I,1775
3
- algosec_appviz/main.py,sha256=h96IyEVtELXmmGuvxrQojh9L45c0ssDG7UB2WPZX4J0,4028
4
- algosec_appviz-0.0.5.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
5
- algosec_appviz-0.0.5.dist-info/METADATA,sha256=aIriv-vJisyeYbnd3K3Qdct_XL_M4GRTyq0ievrAgEo,1798
6
- algosec_appviz-0.0.5.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
7
- algosec_appviz-0.0.5.dist-info/RECORD,,