Skip to content

Commit 97f941f

Browse files
authored
feat: Minor updates, add BadRequestException (#8)
1 parent 37424e7 commit 97f941f

File tree

7 files changed

+18
-9
lines changed

7 files changed

+18
-9
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Please, include the `User-Agent` header with the name of your application or pro
1313
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
1414

1515
- API version: Latest
16-
- Package version: 0.3.3
16+
- Package version: 0.3.4
1717
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
1818

1919
## Requirements.
@@ -27,10 +27,10 @@ Python 3.7+
2727
If the python package is hosted on a repository, you can install directly using:
2828

2929
```sh
30-
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
30+
pip install git+https://github.com/Martin005/phrasetms-python.git
3131
```
3232

33-
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)
33+
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/Martin005/phrasetms-python.git`)
3434

3535
Then import the package:
3636

phrasetms_client/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"""
1515

1616

17-
__version__ = "0.3.3"
17+
__version__ = "0.3.4"
1818

1919
# import apis into sdk package
2020
from phrasetms_client.api.additional_workflow_step_api import AdditionalWorkflowStepApi

phrasetms_client/configuration.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ def to_debug_report(self):
423423
"OS: {env}\n"
424424
"Python Version: {pyversion}\n"
425425
"Version of the API: Latest\n"
426-
"SDK Package Version: 0.3.3".format(env=sys.platform, pyversion=sys.version)
426+
"SDK Package Version: 0.3.4".format(env=sys.platform, pyversion=sys.version)
427427
)
428428

429429
def get_host_settings(self):

phrasetms_client/exceptions.py

+6
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ def __str__(self):
127127
return error_message
128128

129129

130+
class BadRequestException(ApiException):
131+
132+
def __init__(self, status=None, reason=None, http_resp=None):
133+
super(BadRequestException, self).__init__(status, reason, http_resp)
134+
135+
130136
class NotFoundException(ApiException):
131137

132138
def __init__(self, status=None, reason=None, http_resp=None):

phrasetms_client/rest.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from urllib.parse import urlencode, quote_plus
2222
import urllib3
2323

24-
from phrasetms_client.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError
24+
from phrasetms_client.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError, BadRequestException
2525

2626

2727
logger = logging.getLogger(__name__)
@@ -218,6 +218,9 @@ def request(self, method, url, query_params=None, headers=None,
218218
logger.debug("response body: %s", r.data)
219219

220220
if not 200 <= r.status <= 299:
221+
if r.status == 400:
222+
raise BadRequestException(http_resp=r)
223+
221224
if r.status == 401:
222225
raise UnauthorizedException(http_resp=r)
223226

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[tool.poetry]
22
name = "phrasetms_client"
3-
version = "0.3.3"
3+
version = "0.3.4"
44
description = "Phrase TMS API"
55
authors = ["Martin Chrástek"]
66
license = "NoLicense"
77
readme = "README.md"
8-
repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID"
8+
repository = "https://github.com/Martin005/phrasetms-python"
99
keywords = ["OpenAPI", "OpenAPI-Generator", "Phrase TMS API"]
1010

1111
[tool.poetry.dependencies]

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# prerequisite: setuptools
2222
# http://pypi.python.org/pypi/setuptools
2323
NAME = "phrasetms-client"
24-
VERSION = "0.3.3"
24+
VERSION = "0.3.4"
2525
PYTHON_REQUIRES = ">=3.7"
2626
REQUIRES = ["urllib3 >= 1.25.3", "python-dateutil", "pydantic >= 1.10.5, < 2", "aenum"]
2727

0 commit comments

Comments
 (0)