Project requirements: upload the trained model to the object storage system
stepping process: only use requests.post(…, files=…) does not resolve the issue.Specifically, if the Content-Type is directly written as "multipart/form-data", an error will be reported, because the random "boundary" behind multipart/form-data is missing.Online information says that after removing Content-Type from headers, requests will be automatically generated, but after removing it, another error will occur:
Final solution: requests+requests_toolbelt
Code snippet:
CKPT_PATH = "./uploads"ckpt = "trained_model_bert.ckpt"odb_bucket = "odb_sa2ss34id"odb_url = "http://[domain name]/wos/upload