-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdumpFileData
executable file
·59 lines (41 loc) · 1.34 KB
/
dumpFileData
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
57
#!/usr/bin/env python3
# Include all the common functions and libraries.
from cloudperm import *
import configparser
import csv
import json
import sys
import sqlite3
from sqlite3 import Error
# Add on any specific arguments that this program requires.
try:
import argparse
parser = argparse.ArgumentParser(parents=[cloudperm_argparser])
parser.add_argument('documents', metavar='DocumentID', type=str, nargs='+', help='Google Document IDs')
args = parser.parse_args()
except ImportError:
args = None
makeDB()
def main():
"""
Just dump the file data from the API
This program is mostly for developers to use.
"""
pp = pprint.PrettyPrinter(indent=4)
credentials = get_credentials(args)
http = credentials.authorize(httplib2.Http())
service = discovery.build('drive', 'v2', http=http)
parser = configparser.ConfigParser()
parser.read("DriveConfig.INI")
# Get our list of file IDs to check, either form the config file or from the command line arguments.
fileids = [];
if len(args.documents) > 1:
print("For now, this program only takes 1 document id")
sys.exit(1)
docid = args.documents[0]
# Get the document info from the API
doc = service.files().get(fileId=docid).execute()
print(docid)
pp.pprint(doc)
if __name__ == '__main__':
main()