Skip to content

Commit

Permalink
Merge pull request #57 from fingerprintjs/INTER-795-improve-response-…
Browse files Browse the repository at this point in the history
…transparency

Add better error reporting in case of wrong data shape
  • Loading branch information
ilfa authored Jul 24, 2024
2 parents 901f2f3 + 9dc220a commit fb80e9e
Show file tree
Hide file tree
Showing 9 changed files with 400 additions and 84 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/coverage-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
python-version: "3.12"
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip
Expand All @@ -22,7 +22,7 @@ jobs:
coverage run --source=fingerprint_pro_server_api_sdk -m pytest
coverage xml
- name: Get Cover
uses: orgoro/coverage@d77626a5fa35d39123e86d6c62907fabe2491496
uses: orgoro/coverage@3f13a558c5af7376496aa4848bf0224aead366ac
with:
coverageFile: ./coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/coverage-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
python-version: "3.12"
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip
Expand All @@ -38,4 +38,4 @@ jobs:
uses: JamesIves/github-pages-deploy-action@8817a56e5bfec6e2b08345c81f4d422db53a2cdc
with:
branch: gh-pages
folder: htmlcov
folder: htmlcov
2 changes: 1 addition & 1 deletion .github/workflows/functional_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
python-version: "3.12"
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
with:
appId: ${{ vars.APP_ID }}
language: python
language-version: '3.9'
language-version: '3.12'
semantic-release-extra-plugins: |
[email protected]
prepare-command: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.10" ]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python-version }}"
Expand Down
18 changes: 12 additions & 6 deletions fingerprint_pro_server_api_sdk/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from fingerprint_pro_server_api_sdk.configuration import Configuration
import fingerprint_pro_server_api_sdk.models
from fingerprint_pro_server_api_sdk import rest
from fingerprint_pro_server_api_sdk.rest import ApiException


class ApiClient(object):
Expand Down Expand Up @@ -161,12 +162,17 @@ def __call_api(
self.last_response = response_data

return_data = response_data
if _preload_content:
# deserialize response data
if response_type:
return_data = self.deserialize(response_data, response_type)
else:
return_data = None
try:
if _preload_content:
# deserialize response data
if response_type:
return_data = self.deserialize(response_data, response_type)
else:
return_data = None
except ValueError as e:
error = ApiException(http_resp=response_data)
error.reason = e
raise error

if _return_http_data_only:
return (return_data)
Expand Down
18 changes: 12 additions & 6 deletions template/api_client.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import tornado.gen
from {{packageName}}.configuration import Configuration
import {{modelPackage}}
from {{packageName}} import rest
from {{packageName}}.rest import ApiException


class ApiClient(object):
Expand Down Expand Up @@ -159,12 +160,17 @@ class ApiClient(object):
self.last_response = response_data

return_data = response_data
if _preload_content:
# deserialize response data
if response_type:
return_data = self.deserialize(response_data, response_type)
else:
return_data = None
try:
if _preload_content:
# deserialize response data
if response_type:
return_data = self.deserialize(response_data, response_type)
else:
return_data = None
except ValueError as e:
error = ApiException(http_resp=response_data)
error.reason = e
raise error

{{^tornado}}
if _return_http_data_only:
Expand Down
Loading

0 comments on commit fb80e9e

Please sign in to comment.