Skip to content

Commit

Permalink
Merge pull request #55 from opsgenie/Issue-50-python-sdk
Browse files Browse the repository at this point in the history
Adding Exception Reason for 502,504 and default exception
  • Loading branch information
mhamzak008 authored Apr 30, 2021
2 parents bb718ae + cf844c4 commit 15d1bde
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 10 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.3
- Package version: 2.1.4
- 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.3"
__version__ = "2.1.4"

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

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

def get_host_settings(self):
Expand Down
5 changes: 3 additions & 2 deletions opsgenie_sdk/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,10 @@ def build_exception(response):
429: ApiException(reason="Throttling"),
500: ServerErrorException(reason="Internal Server Error"),
501: ServerErrorException(reason="Not Implemented"),
502: ServerErrorException(reason="Bad Gateway"),
503: ServerErrorException(reason="Back-end servers are at capacity"),
-100: ApiException()
}.get(http_error_code, -100)
504: ServerErrorException(reason="Gateway Timeout")
}.get(http_error_code, ApiException(reason="API Encountered a Problem"))

exception.status = response.status
exception.reason = response.reason + ": " + exception.reason
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.3",
"packageVersion": "2.1.4",
"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.3"
VERSION = "2.1.4"
# To install the library, run the following
#
# python setup.py install
Expand Down
5 changes: 3 additions & 2 deletions templates/exceptions.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,10 @@ def build_exception(response):
429: ApiException(reason="Throttling"),
500: ServerErrorException(reason="Internal Server Error"),
501: ServerErrorException(reason="Not Implemented"),
502: ServerErrorException(reason="Bad Gateway"),
503: ServerErrorException(reason="Back-end servers are at capacity"),
-100: ApiException()
}.get(http_error_code, -100)
504: ServerErrorException(reason="Gateway Timeout")
}.get(http_error_code, ApiException(reason="API Encountered a Problem"))

exception.status = response.status
exception.reason = response.reason + ": " + exception.reason
Expand Down

0 comments on commit 15d1bde

Please sign in to comment.