Skip to content

Commit f5c015d

Browse files
authored
Merge pull request #46 from opsgenie/fix-rate-limiting-bug
only make use of the "took" information in the response, when it's present
2 parents 724dbcb + 91388dc commit f5c015d

File tree

9 files changed

+11
-11
lines changed

9 files changed

+11
-11
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
44

55
- API version: 2.0.0
6-
- Package version: 2.1.1
6+
- Package version: 2.1.2
77
- Build package: com.atlassian.opsgenie.codegen.geniepy.GeniepyGenerator
88

99
For more information, please visit [https://www.opsgenie.com/contact-us](https://www.opsgenie.com/contact-us)

opsgenie_sdk/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
from opsgenie_sdk.models.weekday_time_restriction_interval import WeekdayTimeRestrictionInterval
169169
from opsgenie_sdk.models.weekday_time_restriction_interval_all_of import WeekdayTimeRestrictionIntervalAllOf
170170

171-
__version__ = "2.1.1"
171+
__version__ = "2.1.2"
172172

173173
# import apis into sdk package
174174

opsgenie_sdk/api_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
8888
self.default_headers[header_name] = header_value
8989
self.cookie = cookie
9090
# Set default User-Agent.
91-
self.user_agent = 'opsgenie-sdk-python-2.1.1'
91+
self.user_agent = 'opsgenie-sdk-python-2.1.2'
9292

9393
# init metric publishers
9494
self.http_metric_publisher = self.rest_client.http_metric

opsgenie_sdk/configuration.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def to_debug_report(self):
252252
"OS: {env}\n"\
253253
"Python Version: {pyversion}\n"\
254254
"Version of the API: 2.0.0\n"\
255-
"SDK Package Version: 2.1.1".\
255+
"SDK Package Version: 2.1.2".\
256256
format(env=sys.platform, pyversion=sys.version)
257257

258258
def get_host_settings(self):

opsgenie_sdk/rest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def request(self, method, url, query_params=None, headers=None,
241241
('body', body), ('post_params', post_params)]
242242
if "message" not in data:
243243
self.http_metric.build_metric(transaction_id=self.configuration.metrics_transaction_id,
244-
duration=data["took"],
244+
duration=data.get("took"),
245245
resource_path=url,
246246
retry_statistics=copy.deepcopy(self.retrying.statistics),
247247
error=False,
@@ -250,7 +250,7 @@ def request(self, method, url, query_params=None, headers=None,
250250
request=http_metrics_request)
251251
else:
252252
self.http_metric.build_metric(transaction_id=self.configuration.metrics_transaction_id,
253-
duration=data["took"],
253+
duration=data.get("took"),
254254
resource_path=url,
255255
retry_statistics=copy.deepcopy(self.retrying.statistics),
256256
error=True,

samples/alert.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def acknowledge_alert(self, alert_id):
8585
print("Exception when calling AlertApi->acknowledge_alerts: %s\n" % err)
8686

8787
def snooze_alert(self, alert_id):
88-
body = opsgenie_sdk.SnoozeAlertPayload(end_time="2020-04-03T20:05:50.894Z")
88+
body = opsgenie_sdk.SnoozeAlertPayload(end_time="2030-04-03T20:05:50.894Z")
8989
try:
9090
snooze_response = self.alert_api.snooze_alert(identifier=alert_id, snooze_alert_payload=body)
9191
print(snooze_response)

scripts/sdk/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"packageName": "opsgenie_sdk",
33
"projectName": "opsgenie-sdk",
4-
"packageVersion": "2.1.1",
4+
"packageVersion": "2.1.2",
55
"packageUrl": "https://github.com/opsgenie/opsgenie-python-sdk",
66
"sortParamsByRequiredFlag": "true",
77
"hideGenerationTimestamp": "true",

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from setuptools import setup, find_packages # noqa: H301
1717

1818
NAME = "opsgenie-sdk"
19-
VERSION = "2.1.1"
19+
VERSION = "2.1.2"
2020
# To install the library, run the following
2121
#
2222
# python setup.py install

templates/rest.mustache

+2-2
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ class RESTClientObject(object):
232232
('body', body), ('post_params', post_params)]
233233
if "message" not in data:
234234
self.http_metric.build_metric(transaction_id=self.configuration.metrics_transaction_id,
235-
duration=data["took"],
235+
duration=data.get("took"),
236236
resource_path=url,
237237
retry_statistics=copy.deepcopy(self.retrying.statistics),
238238
error=False,
@@ -241,7 +241,7 @@ class RESTClientObject(object):
241241
request=http_metrics_request)
242242
else:
243243
self.http_metric.build_metric(transaction_id=self.configuration.metrics_transaction_id,
244-
duration=data["took"],
244+
duration=data.get("took"),
245245
resource_path=url,
246246
retry_statistics=copy.deepcopy(self.retrying.statistics),
247247
error=True,

0 commit comments

Comments
 (0)