3from apiclient.discovery
import build
4from httplib2
import Http
5from oauth2client
import file, client, tools
6from apiclient.http
import MediaFileUpload
7from oauth2client.tools
import argparser, run_flow
10args = argparser.parse_args()
11args.noauth_local_webserver =
True
15rel_path = full_path.split(
"/")[:-1]
16rel_path =
"/".join(rel_path)
19CLIENT_SECRET = rel_path+
"/client_secret.json"
22SCOPES = [
"https://www.googleapis.com/auth/drive",
"https://www.googleapis.com/auth/drive.file",
"https://www.googleapis.com/auth/drive.readonly",
23"https://www.googleapis.com/auth/drive.metadata.readonly",
"https://www.googleapis.com/auth/drive.appdata",
"https://www.googleapis.com/auth/drive.metadata",
24"https://www.googleapis.com/auth/drive.photos.readonly"]
27store = file.Storage(rel_path+
"/token.json")
30if not creds
or creds.invalid:
31 flow = client.flow_from_clientsecrets(CLIENT_SECRET, SCOPES)
32 creds = run_flow(flow, store, args)
34drive_service = build(
"drive",
"v3", http=creds.authorize(Http()))