Skip to content

Commit f5aa331

Browse files
authored
Merge pull request #8 from flix-tech/better-error-reporting
Better error reporting
2 parents 2167a91 + 10090cb commit f5aa331

File tree

6 files changed

+23
-16
lines changed

6 files changed

+23
-16
lines changed

.github/workflows/python-package.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
python-version:
16-
- "3.7"
17-
- "3.8"
1816
- "3.9"
1917
- "3.10"
18+
- "3.11"
19+
- "3.12"
20+
2021

2122
steps:
2223
- uses: actions/checkout@v2

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ It takes care of:
1010

1111
It works with [kafka-python][], and extra arguments are forwarded to it.
1212

13-
[kafka-python]: https://github.com/dpkp/kafka-python
13+
[kafka-python]: https://github.com/wbarnha/kafka-python-ng
1414

1515

1616
## Installing

kafka_schema_registry/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from kafka.admin import NewTopic
1111
from kafka.errors import TopicAlreadyExistsError, NoBrokersAvailable
1212
from requests import request
13+
from requests.exceptions import JSONDecodeError
1314

1415
logger = logging.getLogger(__name__)
1516

@@ -86,9 +87,14 @@ def publish_schemas(
8687
'Content-Type': 'application/json'
8788
}
8889
)
89-
if 'id' not in value_resp.json():
90+
try:
91+
obj = value_resp.json()
92+
except JSONDecodeError:
93+
logger.error(f'Error decoding response: {value_resp.text}')
94+
raise
95+
if 'id' not in obj:
9096
logger.error(f'No id in response: {value_resp.json()}')
91-
value_schema_id = value_resp.json()['id']
97+
value_schema_id = obj['id']
9298

9399
key_schema_id = None
94100
if key_schema is not None:

requirements-dev.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
pytest==6.2.5
2-
pytest-cov==3.0.0
3-
flake8==4.0.1
4-
responses==0.17.0
5-
twine==3.7.1
6-
wheel==0.37.1
1+
pytest==8.3.4
2+
pytest-cov==6.0.0
3+
flake8==7.1.1
4+
responses==0.25.3
5+
twine==6.0.1
6+
wheel==0.45.1
77

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
fastavro==1.4.9
2-
kafka-python==2.0.2
3-
requests==2.27.1
1+
fastavro==1.9.7
2+
kafka-python-ng==2.2.3
3+
requests==2.32.3

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
"Changelog": "https://github.com/flix-tech/kafka-schema-registry/blob/master/CHANGELOG.md", # noqa
2020
"Source": 'https://github.com/flix-tech/kafka-schema-registry',
2121
},
22-
python_requires='>=3.7',
22+
python_requires='>=3.9',
2323
install_requires=[
2424
'fastavro',
25-
'kafka-python',
25+
'kafka-python-ng',
2626
'requests',
2727
],
2828
packages=['kafka_schema_registry'],

0 commit comments

Comments
 (0)