|
14 | 14 | SEC_HEADER = 'SEC'
|
15 | 15 | SEC_ADMIN_TOKEN = 'SEC_ADMIN_TOKEN'
|
16 | 16 |
|
17 |
| -def live_rest(rest_action, request_url, version, headers, data, |
18 |
| - params, json_body, verify, timeout, **kwargs): |
19 |
| - if not isinstance(verify, str): |
20 |
| - verify = _get_cert_filepath() |
21 |
| - return _rest(rest_action, request_url, version, headers, data, |
22 |
| - params, json_body, verify, timeout, **kwargs) |
23 |
| - |
24 |
| -def sdk_rest(rest_action, request_url, version, headers, data, |
25 |
| - params, json_body, verify, timeout, **kwargs): |
26 |
| - if not isinstance(verify, str): |
27 |
| - # To be completed. Default to no verification for now. |
28 |
| - verify = False |
29 |
| - return _rest(rest_action, request_url, version, headers, data, |
30 |
| - params, json_body, verify, timeout, **kwargs) |
31 |
| - |
32 |
| -def _rest(rest_action, request_url, version, headers, data, |
33 |
| - params, json_body, verify, timeout, **kwargs): |
| 17 | +def rest(rest_action, request_url, version, headers, data, |
| 18 | + params, json_body, verify, timeout, **kwargs): |
34 | 19 | rest_func = _choose_rest_function(rest_action)
|
35 | 20 | full_url = _generate_full_url(request_url)
|
36 | 21 | rest_headers = _add_headers(headers, version)
|
37 | 22 | proxies = _add_proxies()
|
38 | 23 | return rest_func(full_url, headers=rest_headers, data=data, params=params,
|
39 | 24 | json=json_body, verify=verify, timeout=timeout, proxies=proxies, **kwargs)
|
40 | 25 |
|
41 |
| -def _get_cert_filepath(): |
42 |
| - with open('/proc/mounts') as mounts: |
43 |
| - if '/etc/qradar_pki' in mounts.read(): |
44 |
| - return '/etc/pki/tls/certs/ca-bundle.crt' |
45 |
| - return False |
46 |
| - |
47 | 26 | def _add_headers(headers, version=None):
|
48 | 27 | if headers is None:
|
49 | 28 | headers = {}
|
|
0 commit comments