forked from IronBox/ironbox-client-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIronBoxUploadFileCmdLine.py
49 lines (43 loc) · 1.36 KB
/
IronBoxUploadFileCmdLine.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
#!/usr/bin/python
# ---------------------------------------------------
#
# Demonstrates how to upload a file to
# an IronBox secure package or container
# using command line parameters:
#
# Usage:
# IronBoxUploadFileCmdLine.py containerid email password file_to_upload
#
# Written by KevinLam@goironbox.com
# Website: www.goironbox.com
#
# ---------------------------------------------------
from IronBoxREST import IronBoxRESTClient
import sys
from os import path
# ---------------------------------------------------
# Your IronBox authentication parameters, these will
# be set by command line arguments
# ---------------------------------------------------
ContainerID = 0
IronBoxEmail = ""
IronBoxPassword = ""
IronBoxAPIServerURL = "https://api.goironcloud.com/latest/"
IronBoxAPIVersion = "latest"
InFile = ""
IronBoxFileName = ""
# ---------------------------------------------------
# Main
# ---------------------------------------------------
def main():
ContainerID = sys.argv[1]
IronBoxEmail = sys.argv[2]
IronBoxPassword = sys.argv[3]
InFile = sys.argv[4]
IronBoxFileName = path.basename(InFile)
IronBoxRESTObj = IronBoxRESTClient(
IronBoxEmail, IronBoxPassword, version=IronBoxAPIVersion, verbose=True
)
IronBoxRESTObj.upload_file_to_container(ContainerID, InFile, IronBoxFileName)
if __name__ == "__main__":
main()