-
Notifications
You must be signed in to change notification settings - Fork 9
/
IronBoxGetBlobInfoListByState.py
56 lines (49 loc) · 1.66 KB
/
IronBoxGetBlobInfoListByState.py
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
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/python
#---------------------------------------------------
#
# Demonstrates how to retrieve the ID and names of
# each blob in an IronBox container by the given
# state.
#
# Written by [email protected]
# Website: www.goironbox.com
#
# Usage:
# python IronBoxGetBlobInfoListByState.py
#
#---------------------------------------------------
import sys
from os import listdir
from os.path import isfile, join
from IronBoxREST import IronBoxRESTClient
#---------------------------------------------------
# Your IronBox authentication parameters, you could
# also pass these in as command arguments
#---------------------------------------------------
ContainerID = 100777
IronBoxEmail = "[email protected]"
IronBoxPassword = "password"
IronBoxAPIServerURL = "https://api.goironcloud.com/latest/"
IronBoxAPIVersion = "latest"
# Gets all the blobs in the Ready state (2). Other states:
# 0 = Blob created
# 1 = Entity is uploading
# 2 = Ready
# 3 = Checked out
# 4 = Entity is modifying
# 5 = None
BlobState = 2
#---------------------------------------------------
# Main
#---------------------------------------------------
def main():
# Create an instance of the IronBox REST class
IronBoxRESTObj = IronBoxRESTClient(IronBoxEmail, IronBoxPassword, version=IronBoxAPIVersion, verbose=True)
# Get all the blobs in a ready state, result is a tuple list
# where 0 = blob ID and 1 = blob name
result = IronBoxRESTObj.GetContainerBlobInfoListByState(ContainerID, BlobState)
for item in result:
print "%s -> %s" % (item[0],item[1])
#---------------------------------------------------
if __name__ == "__main__":
main()