Weiyun1025's picture
Upload folder using huggingface_hub
2abfccb verified
from petrel_client.client import Client
import hashlib
client = Client('conf/s3config.ini')
filename = 'cluster1:s3://my-bucket/object.111'
content = b'a' * 1024
print('put: key len:', len(filename), 'content len:', len(content))
client.put(filename, content, update_cache=True)
content, info = client.get_and_update(filename, enable_etag=True)
print('size:', len(content))
digest = hashlib.md5(content).hexdigest()
print('digest:', digest)
print('etag:', info['etag'])