Skip to content

Commit df36888

Browse files
committed
Merge branch 'master' of github.com:adamtheturtle/vws-python
2 parents 37a20a2 + bd35891 commit df36888

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

CHANGELOG.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Changelog
66
Next
77
----
88

9+
2019.12.14.0
10+
------------
11+
912
2019.12.07.0
1013
------------
1114

dev-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pygithub==1.44.1
2525
pylint==2.4.4 # Lint
2626
pyroma==2.6 # Packaging best practices checker
2727
pytest-cov==2.8.1 # Measure code coverage
28-
pytest==5.3.1 # Test runners
28+
pytest==5.3.2 # Test runners
2929
sphinx-autodoc-typehints==1.10.3
3030
sphinxcontrib-spelling==4.3.0
3131
twine==3.1.1

src/vws/exceptions.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""
22
Custom exceptions for Vuforia errors.
33
"""
4+
5+
import json
46
from urllib.parse import urlparse
57

68
import requests
@@ -285,6 +287,15 @@ def response(self) -> Response:
285287
"""
286288
return self._response
287289

290+
@property
291+
def target_name(self) -> str:
292+
"""
293+
The target name which already exists.
294+
"""
295+
response_body = self.response.request.body or b''
296+
request_json = json.loads(response_body)
297+
return str(request_json['name'])
298+
288299

289300
class ImageTooLarge(Exception):
290301
"""

tests/test_exceptions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def test_target_name_exist(
149149
)
150150

151151
assert exc.value.response.status_code == codes.FORBIDDEN
152+
assert exc.value.target_name == 'x'
152153

153154

154155
def test_project_inactive(

0 commit comments

Comments
 (0)