delete uploadcare files older than 14 days
#!/bin/python | |
# installation: | |
# pip install pytz pyuploadcare==1.3.1 | |
import pytz | |
from datetime import timedelta, datetime | |
from pyuploadcare import conf | |
from pyuploadcare.api_resources import FileList | |
MAX_LIFETIME = 14 # days | |
conf.pub_key = 'demopublickey' | |
conf.secret = 'demoprivatekey' | |
dt_cutoff = datetime.now(pytz.utc) - timedelta(days=MAX_LIFETIME) | |
if __name__ == '__main__': | |
for f in FileList(stored=True, request_limit=500, until=dt_cutoff): | |
print 'deleting {0}...'.format(f.uuid) | |
f.delete() |
This comment has been minimized.
This comment has been minimized.
In case of old version conf.api_version = '0.4' |
This comment has been minimized.
This comment has been minimized.
this needs to be updated for batch delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
For API verion 0.5: