Skip to content

Commit

Permalink
Merge pull request #46 from opsgenie/fix-rate-limiting-bug
Browse files Browse the repository at this point in the history
only make use of the "took" information in the response, when it's present
  • Loading branch information
zfr authored Feb 3, 2021
2 parents 724dbcb + 91388dc commit f5c015d
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 2.0.0
- Package version: 2.1.1
- Package version: 2.1.2
- Build package: com.atlassian.opsgenie.codegen.geniepy.GeniepyGenerator

For more information, please visit [https://www.opsgenie.com/contact-us](https://www.opsgenie.com/contact-us)
Expand Down
2 changes: 1 addition & 1 deletion opsgenie_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
from opsgenie_sdk.models.weekday_time_restriction_interval import WeekdayTimeRestrictionInterval
from opsgenie_sdk.models.weekday_time_restriction_interval_all_of import WeekdayTimeRestrictionIntervalAllOf

__version__ = "2.1.1"
__version__ = "2.1.2"

# import apis into sdk package

Expand Down
2 changes: 1 addition & 1 deletion opsgenie_sdk/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'opsgenie-sdk-python-2.1.1'
self.user_agent = 'opsgenie-sdk-python-2.1.2'

# init metric publishers
self.http_metric_publisher = self.rest_client.http_metric
Expand Down
2 changes: 1 addition & 1 deletion opsgenie_sdk/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def to_debug_report(self):
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: 2.0.0\n"\
"SDK Package Version: 2.1.1".\
"SDK Package Version: 2.1.2".\
format(env=sys.platform, pyversion=sys.version)

def get_host_settings(self):
Expand Down
4 changes: 2 additions & 2 deletions opsgenie_sdk/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def request(self, method, url, query_params=None, headers=None,
('body', body), ('post_params', post_params)]
if "message" not in data:
self.http_metric.build_metric(transaction_id=self.configuration.metrics_transaction_id,
duration=data["took"],
duration=data.get("took"),
resource_path=url,
retry_statistics=copy.deepcopy(self.retrying.statistics),
error=False,
Expand All @@ -250,7 +250,7 @@ def request(self, method, url, query_params=None, headers=None,
request=http_metrics_request)
else:
self.http_metric.build_metric(transaction_id=self.configuration.metrics_transaction_id,
duration=data["took"],
duration=data.get("took"),
resource_path=url,
retry_statistics=copy.deepcopy(self.retrying.statistics),
error=True,
Expand Down
2 changes: 1 addition & 1 deletion samples/alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def acknowledge_alert(self, alert_id):
print("Exception when calling AlertApi->acknowledge_alerts: %s\n" % err)

def snooze_alert(self, alert_id):
body = opsgenie_sdk.SnoozeAlertPayload(end_time="2020-04-03T20:05:50.894Z")
body = opsgenie_sdk.SnoozeAlertPayload(end_time="2030-04-03T20:05:50.894Z")
try:
snooze_response = self.alert_api.snooze_alert(identifier=alert_id, snooze_alert_payload=body)
print(snooze_response)
Expand Down
2 changes: 1 addition & 1 deletion scripts/sdk/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"packageName": "opsgenie_sdk",
"projectName": "opsgenie-sdk",
"packageVersion": "2.1.1",
"packageVersion": "2.1.2",
"packageUrl": "https://github.com/opsgenie/opsgenie-python-sdk",
"sortParamsByRequiredFlag": "true",
"hideGenerationTimestamp": "true",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from setuptools import setup, find_packages # noqa: H301

NAME = "opsgenie-sdk"
VERSION = "2.1.1"
VERSION = "2.1.2"
# To install the library, run the following
#
# python setup.py install
Expand Down
4 changes: 2 additions & 2 deletions templates/rest.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class RESTClientObject(object):
('body', body), ('post_params', post_params)]
if "message" not in data:
self.http_metric.build_metric(transaction_id=self.configuration.metrics_transaction_id,
duration=data["took"],
duration=data.get("took"),
resource_path=url,
retry_statistics=copy.deepcopy(self.retrying.statistics),
error=False,
Expand All @@ -241,7 +241,7 @@ class RESTClientObject(object):
request=http_metrics_request)
else:
self.http_metric.build_metric(transaction_id=self.configuration.metrics_transaction_id,
duration=data["took"],
duration=data.get("took"),
resource_path=url,
retry_statistics=copy.deepcopy(self.retrying.statistics),
error=True,
Expand Down

0 comments on commit f5c015d

Please sign in to comment.