pip install Pillow
import hashlib from io import BytesIO def get_hash(file): """ :param bytes file: :return: """ md5hash = hashlib.md5(Image.open(file).tobytes()) return md5hash.hexdigest() url = 'URL' r = requests.get(url, allow_redirects=True, stream=True) print(get_hash(BytesIO(r.content)))
标签:hash,get,Python,URL,file,return From: https://www.cnblogs.com/felixwan/p/17040362.html