It seems like the write_blob
function (found here) uses the deprecated Files API from the Blobstore.
def write_blob(self, data, info):
blob = files.blobstore.create(
mime_type=info['type'],
_blobinfo_uploaded_filename=info['name']
)
with files.open(blob, 'a') as f:
f.write(data)
files.finalize(blob)
return files.blobstore.get_blob_key(blob)
See here for deprecation info
How might this function be rewritten?
The Files API to the Blobstore has not just been deprecated without any alternative. Google Cloud Storage (hereafter: GCS) is the more future-friendly way to perform such operations. You can find sample code here that shows how to create files, stat files, delete files, etc. in a GCS bucket. You can read here for more in-depth documentation on the GCS client library functions.