Delete files in uploadcare — python
Sep 5, 2018 · 1 min read
If you have many files in your uploadcare and you want delete this files, you can try delete with this script
First make to the file, delete.py for example.
import pytz
from datetime import timedelta, datetime
import time
from pyuploadcare import conf
from pyuploadcare.api_resources import FileList, FilesStorageMAX_LIFETIME = 30 # days
conf.pub_key = ‘your pub key’
conf.secret = ‘your secret key’//In date time you can put the date.. for example i want delete until september 25 dt_cutoff = datetime(2018, 8, 25, 13, 39, 23 ,tzinfo=pytz.utc) — timedelta(days=MAX_LIFETIME)if __name__ == ‘__main__’:uuid_list = [f.uuid for f in FileList(starting_point=dt_cutoff,
ordering=’-datetime_uploaded’,
stored=True,
request_limit=500)]
ts1 = time.time()
fs = FilesStorage(uuid_list)
fs.delete()
ts2 = time.time()
print (“Operation completed”)
- The pub key and secret, these are on the site with your acount
- In API keys

And fine!