opsrampcli 1.9.0__tar.gz → 1.10.0__tar.gz
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.
- {opsrampcli-1.9.0 → opsrampcli-1.10.0}/PKG-INFO +1 -1
- {opsrampcli-1.9.0 → opsrampcli-1.10.0}/opsrampcli/opsrampenv.py +26 -17
- {opsrampcli-1.9.0 → opsrampcli-1.10.0}/pyproject.toml +1 -1
- {opsrampcli-1.9.0 → opsrampcli-1.10.0}/README.md +0 -0
- {opsrampcli-1.9.0 → opsrampcli-1.10.0}/opsrampcli/DataSource.py +0 -0
- {opsrampcli-1.9.0 → opsrampcli-1.10.0}/opsrampcli/JSONDataSource.py +0 -0
- {opsrampcli-1.9.0 → opsrampcli-1.10.0}/opsrampcli/ServiceNowDataSource.py +0 -0
- {opsrampcli-1.9.0 → opsrampcli-1.10.0}/opsrampcli/URLDataSource.py +0 -0
- {opsrampcli-1.9.0 → opsrampcli-1.10.0}/opsrampcli/__init.py__ +0 -0
- {opsrampcli-1.9.0 → opsrampcli-1.10.0}/opsrampcli/alerts.py +0 -0
- {opsrampcli-1.9.0 → opsrampcli-1.10.0}/opsrampcli/argparsing.py +0 -0
- {opsrampcli-1.9.0 → opsrampcli-1.10.0}/opsrampcli/customattrs.py +0 -0
- {opsrampcli-1.9.0 → opsrampcli-1.10.0}/opsrampcli/discovery.py +0 -0
- {opsrampcli-1.9.0 → opsrampcli-1.10.0}/opsrampcli/escalationpolicies.py +0 -0
- {opsrampcli-1.9.0 → opsrampcli-1.10.0}/opsrampcli/incidents.py +0 -0
- {opsrampcli-1.9.0 → opsrampcli-1.10.0}/opsrampcli/integrations.py +0 -0
- {opsrampcli-1.9.0 → opsrampcli-1.10.0}/opsrampcli/monitoring.py +0 -0
- {opsrampcli-1.9.0 → opsrampcli-1.10.0}/opsrampcli/opsrampcli.py +0 -0
- {opsrampcli-1.9.0 → opsrampcli-1.10.0}/opsrampcli/resources.py +0 -0
- {opsrampcli-1.9.0 → opsrampcli-1.10.0}/opsrampcli/servicemaps.py +0 -0
- {opsrampcli-1.9.0 → opsrampcli-1.10.0}/opsrampcli/test.py +0 -0
|
@@ -256,24 +256,33 @@ class OpsRampEnv:
|
|
|
256
256
|
params['pageSize'] = page_size
|
|
257
257
|
params['pageNo'] = page_no
|
|
258
258
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
max_retries = 3
|
|
260
|
+
sleep_interval = 5
|
|
261
|
+
attempt = 0
|
|
262
262
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
263
|
+
for attempt in range(max_retries):
|
|
264
|
+
try:
|
|
265
|
+
response = requests.request("GET", url, headers=headers, params=params, verify=self.isSecure)
|
|
266
|
+
logger.debug(f'OpsRampEnv.get_with_pagination GET response - response:{response} response.text:{response.text} response.headers:{response.headers}')
|
|
267
|
+
|
|
268
|
+
if 'x-ratelimit-remaining' in response.headers and int(response.headers['x-ratelimit-remaining']) < 2 :
|
|
269
|
+
sleeptime = abs(int(response.headers['x-ratelimit-reset']) - int(datetime.now().timestamp()) + 3)
|
|
270
|
+
if sleeptime > 60:
|
|
271
|
+
sleeptime = sleeptime % 60
|
|
272
|
+
logger.warning(f'Sleeping for {str(sleeptime)} sec to wait for API throttling limit to reset..')
|
|
273
|
+
time.sleep(sleeptime)
|
|
274
|
+
bodydict = response.json()
|
|
275
|
+
results = []
|
|
276
|
+
if result_array_key in bodydict:
|
|
277
|
+
results = bodydict[result_array_key]
|
|
278
|
+
if 'nextPage' in bodydict and bodydict['nextPage']:
|
|
279
|
+
return results + self.get_with_pagination(path=path, result_array_key=result_array_key, params=params, page_no=page_no+1, page_size=page_size)
|
|
280
|
+
else:
|
|
281
|
+
return results
|
|
282
|
+
except Exception as exc:
|
|
283
|
+
logger.warning(f'OpsRampEnv.get_with_pagination Exception on attempt {attempt + 1}. Retry in {sleep_interval} sec...', exc_info=exc)
|
|
284
|
+
time.sleep(sleep_interval)
|
|
285
|
+
attempt = attempt + 1
|
|
277
286
|
|
|
278
287
|
def get_without_pagination(self, path:str):
|
|
279
288
|
logger.debug(f'OpsRampEnv.get_without_pagination called - path:{path}')
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|