Skip to content

Commit

Permalink
Merge pull request #53 from opsgenie/2.1.3
Browse files Browse the repository at this point in the history
2.1.3
  • Loading branch information
zfr authored Mar 10, 2021
2 parents f3f1419 + a937043 commit bb718ae
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 51 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.2
- Package version: 2.1.3
- 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.2"
__version__ = "2.1.3"

# 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.2'
self.user_agent = 'opsgenie-sdk-python-2.1.3'

# 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.2".\
"SDK Package Version: 2.1.3".\
format(env=sys.platform, pyversion=sys.version)

def get_host_settings(self):
Expand Down
39 changes: 20 additions & 19 deletions opsgenie_sdk/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,27 +236,28 @@ def request(self, method, url, query_params=None, headers=None,
# log response body
logger.debug("response body: %s", r.data)

data = self.decodeResponse(r.data)
http_metrics_request = [('method', method), ('url', url), ('query_params', query_params), ('headers', headers),
('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.get("took"),
resource_path=url,
retry_statistics=copy.deepcopy(self.retrying.statistics),
error=False,
status=r.status,
status_code=r.status,
request=http_metrics_request)
else:
self.http_metric.build_metric(transaction_id=self.configuration.metrics_transaction_id,
duration=data.get("took"),
resource_path=url,
retry_statistics=copy.deepcopy(self.retrying.statistics),
error=True,
status=r.status,
status_code=r.status,
request=http_metrics_request)

try:
data = self.decodeResponse(r.data)
duration = data.get("took")
if "message" not in data:
error = False
else:
error = True
except:
duration = None
error = True

self.http_metric.build_metric(transaction_id=self.configuration.metrics_transaction_id,
duration=duration,
resource_path=url,
retry_statistics=copy.deepcopy(self.retrying.statistics),
error=error,
status=r.status,
status_code=r.status,
request=http_metrics_request)

should_retry = self.__checkHttpCode__(r.status)
if should_retry:
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.2",
"packageVersion": "2.1.3",
"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.2"
VERSION = "2.1.3"
# To install the library, run the following
#
# python setup.py install
Expand Down
14 changes: 7 additions & 7 deletions templates/api_client.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,13 @@ class ApiClient(object):

# perform request and return response
try:
response_data = {{#asyncio}}await {{/asyncio}}{{#tornado}}yield {{/tornado}}self.retrying.call(fn=self.request, method=method, url=url,
query_params=query_params,
headers=header_params,
post_params=post_params,
body=body,
_preload_content=_preload_content,
_request_timeout=_request_timeout)
response_data = {{#asyncio}}await {{/asyncio}}{{#tornado}}yield {{/tornado}}self.retrying(fn=self.request, method=method, url=url,
query_params=query_params,
headers=header_params,
post_params=post_params,
body=body,
_preload_content=_preload_content,
_request_timeout=_request_timeout)
except Exception as exception:
self._sdk_request_details = {
"query_params": query_params,
Expand Down
39 changes: 20 additions & 19 deletions templates/rest.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -227,27 +227,28 @@ class RESTClientObject(object):
# log response body
logger.debug("response body: %s", r.data)

data = self.decodeResponse(r.data)
http_metrics_request = [('method', method), ('url', url), ('query_params', query_params), ('headers', headers),
('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.get("took"),
resource_path=url,
retry_statistics=copy.deepcopy(self.retrying.statistics),
error=False,
status=r.status,
status_code=r.status,
request=http_metrics_request)
else:
self.http_metric.build_metric(transaction_id=self.configuration.metrics_transaction_id,
duration=data.get("took"),
resource_path=url,
retry_statistics=copy.deepcopy(self.retrying.statistics),
error=True,
status=r.status,
status_code=r.status,
request=http_metrics_request)

try:
data = self.decodeResponse(r.data)
duration = data.get("took")
if "message" not in data:
error = False
else:
error = True
except:
duration = None
error = True

self.http_metric.build_metric(transaction_id=self.configuration.metrics_transaction_id,
duration=duration,
resource_path=url,
retry_statistics=copy.deepcopy(self.retrying.statistics),
error=error,
status=r.status,
status_code=r.status,
request=http_metrics_request)

should_retry = self.__checkHttpCode__(r.status)
if should_retry:
Expand Down

0 comments on commit bb718ae

Please sign in to comment.