Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

TypeError: 'hashlib.HASH' object is not callable in validate_data method #27

Open
AissaGeek opened this issue Oct 29, 2024 · 0 comments

Comments

@AissaGeek
Copy link

There is a bug in the validate_data method of the DownloadWorker class in downloader/__init__.py. The hash_function is being used incorrectly as a callable, which results in a TypeError. The hash_function is an instance and should use its update method instead.

Suggested fix

hash_function.update(data)
hash_value = base64.b64encode(hash_function.digest()).decode()

Environment

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "wis2downloader"
version = "0.1.0"
description = "Python package to manage subscriptions and downloads from the WIS2.0"
authors = ["Rory Burke"]
maintainers = ["Rory Burke", "David I. Berry <dberry@wmo.int>"]
readme = "README.md"
keywords = ["WIS2.0", "MQTT", "subscribe", "download"]
homepage = "https://mfi.fr"

[tool.poetry.dependencies]
python = ">=3.9"
certifi = ">=2024.2.2"
flask = ">=3.0.3"
flask-cors = ">=4.0.0"
paho-mqtt = ">=2.0.0"
prometheus_client = ">=0.20.0"
pywis-topics = ">=0.3.2"
tenacity = "^9.0.0"
minio = "^7.2.10"

[tool.poetry.scripts]
wis2downloader = "wis2downloader:cli.cli"
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant