diff --git a/.github/workflows/python-package.yaml b/.github/workflows/python-package.yaml index 8cb1029..4f32ab5 100644 --- a/.github/workflows/python-package.yaml +++ b/.github/workflows/python-package.yaml @@ -13,10 +13,11 @@ jobs: fail-fast: false matrix: python-version: - - "3.7" - - "3.8" - "3.9" - "3.10" + - "3.11" + - "3.12" + steps: - uses: actions/checkout@v2 diff --git a/README.md b/README.md index 02d1e78..f164420 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ It takes care of: It works with [kafka-python][], and extra arguments are forwarded to it. -[kafka-python]: https://github.com/dpkp/kafka-python +[kafka-python]: https://github.com/wbarnha/kafka-python-ng ## Installing diff --git a/kafka_schema_registry/__init__.py b/kafka_schema_registry/__init__.py index bae3f41..f8a2fa7 100644 --- a/kafka_schema_registry/__init__.py +++ b/kafka_schema_registry/__init__.py @@ -10,6 +10,7 @@ from kafka.admin import NewTopic from kafka.errors import TopicAlreadyExistsError, NoBrokersAvailable from requests import request +from requests.exceptions import JSONDecodeError logger = logging.getLogger(__name__) @@ -86,9 +87,14 @@ def publish_schemas( 'Content-Type': 'application/json' } ) - if 'id' not in value_resp.json(): + try: + obj = value_resp.json() + except JSONDecodeError: + logger.error(f'Error decoding response: {value_resp.text}') + raise + if 'id' not in obj: logger.error(f'No id in response: {value_resp.json()}') - value_schema_id = value_resp.json()['id'] + value_schema_id = obj['id'] key_schema_id = None if key_schema is not None: diff --git a/requirements-dev.txt b/requirements-dev.txt index 0d7066b..9923f15 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,7 +1,7 @@ -pytest==6.2.5 -pytest-cov==3.0.0 -flake8==4.0.1 -responses==0.17.0 -twine==3.7.1 -wheel==0.37.1 +pytest==8.3.4 +pytest-cov==6.0.0 +flake8==7.1.1 +responses==0.25.3 +twine==6.0.1 +wheel==0.45.1 diff --git a/requirements.txt b/requirements.txt index 21c60b8..688223d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -fastavro==1.4.9 -kafka-python==2.0.2 -requests==2.27.1 +fastavro==1.9.7 +kafka-python-ng==2.2.3 +requests==2.32.3 diff --git a/setup.py b/setup.py index 84978ac..ec702dd 100644 --- a/setup.py +++ b/setup.py @@ -19,10 +19,10 @@ "Changelog": "https://github.com/flix-tech/kafka-schema-registry/blob/master/CHANGELOG.md", # noqa "Source": 'https://github.com/flix-tech/kafka-schema-registry', }, - python_requires='>=3.7', + python_requires='>=3.9', install_requires=[ 'fastavro', - 'kafka-python', + 'kafka-python-ng', 'requests', ], packages=['kafka_schema_registry'],