forked from taiojia/pycs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflushcdn.py
More file actions
43 lines (27 loc) · 727 Bytes
/
flushcdn.py
File metadata and controls
43 lines (27 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
__author__ = 'Taio'
from vulpo.scs.connection import SCSConnection
import sys
from keys import keys
k = keys.Keys()
access_key = k.get_access_key()
security_key = k.get_security_key()
conn = SCSConnection(access_key, security_key)
bn = sys.argv[1]
key = sys.argv[2]
def all_buckets():
rs = conn.get_all_buckets()
return rs
def bucket_name(name):
return conn.get_bucket(name)
my_bucket = bucket_name(bn)
def delete_key(my_bucket, key):
return my_bucket.delete_key(key)
def main():
print 'Spaces:'
for i in all_buckets():
print i.name
print 'delete key from: ', my_bucket.name
delete_key(my_bucket, key)
if __name__ == '__main__':
if len(sys.argv) is 3:
main()