We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 93802ff + b2c2c35 commit 0168c3bCopy full SHA for 0168c3b
cfgrib/messages.py
@@ -531,8 +531,11 @@ def from_indexpath_or_filestream(
531
# Reading and writing the index can be explicitly suppressed by passing indexpath==''.
532
if not indexpath:
533
return cls.from_fieldset(filestream, index_keys, computed_keys)
534
-
535
- hash = hashlib.md5(repr(index_keys).encode("utf-8")).hexdigest()
+ repr_index_keys = repr(index_keys).encode("utf-8")
+ try:
536
+ hash = hashlib.md5(repr_index_keys, usedforsecurity=False).hexdigest()
537
+ except TypeError:
538
+ hash = hashlib.md5(repr_index_keys).hexdigest()
539
indexpath = indexpath.format(path=filestream.path, hash=hash, short_hash=hash[:5])
540
try:
541
with compat_create_exclusive(indexpath) as new_index_file:
0 commit comments