Ejemplo n.º 1
0
def main():
	"""Shows basic usage of the Drive v3 API.
	Prints the names and ids of the first 10 files the user has access to.
	"""
	creds = None
	# The file token.pickle stores the user's access and refresh tokens, and is
	# created automatically when the authorization flow completes for the first
	# time.
	if os.path.exists('token.pickle'):
		with open('token.pickle', 'rb') as token:
			creds = pickle.load(token)

	# If there are no (valid) credentials available, let the user log in.
	if not creds or not creds.valid:
		if creds and creds.expired and creds.refresh_token:
			creds.refresh(Request())
		else:
			flow = InstalledAppFlow.from_client_secrets_file(
				'credentials.json', SCOPES)
			creds = flow.run_local_server(port=0)
		# Save the credentials for the next run
		with open('token.pickle', 'wb') as token:
			pickle.dump(creds, token)

	service = build('drive', 'v3', credentials=creds)
	




	# Load Local Configurations
	local_config = loadConfig('local_config')
	# Developer Intro
	developerIntro("who.is.vikas")
	# Upload New Folders and Files
	print('======================================================================')
	print('                           UPLOAD HANDLER                             ')
	print('======================================================================')
	uploadFolder(service, local_config['local-entry'], local_config['gDrive-entry'])
	# Download Old Folders and Files
	print('======================================================================')
	print('                          DOWNLOAD HANDLER                            ')
	print('======================================================================')
	downloadFolder(service, local_config['local-entry'], local_config['gDrive-entry'])
	print('======================================================================')
	print('                              SYNQ OVER                               ')
	print('======================================================================')
Ejemplo n.º 2
0
# If false, no index is generated.
#epub_use_index = True

#=======
# rst2pdf
#
# Grouping the document tree into PDF files. List of tuples
# (source start file, target name, title, author, options).
#
# See the Sphinx chapter of https://ralsina.me/static/manual.pdf
#
# FIXME: Do not add the index file here; the result will be too big. Adding
# multiple PDF files here actually tries to get the cross-referencing right
# *between* PDF files.
pdf_documents = [
    ('kernel-documentation', u'Kernel', u'Kernel', u'J. Random Bozo'),
]

# kernel-doc extension configuration for running Sphinx directly (e.g. by Read
# the Docs). In a normal build, these are supplied from the Makefile via command
# line arguments.
kerneldoc_bin = '../scripts/kernel-doc'
kerneldoc_srctree = '..'

# ------------------------------------------------------------------------------
# Since loadConfig overwrites settings from the global namespace, it has to be
# the last statement in the conf.py file
# ------------------------------------------------------------------------------
loadConfig(globals())
Ejemplo n.º 3
0
Archivo: conf.py Proyecto: Endika/linux
# If false, no index is generated.
#epub_use_index = True

#=======
# rst2pdf
#
# Grouping the document tree into PDF files. List of tuples
# (source start file, target name, title, author, options).
#
# See the Sphinx chapter of http://ralsina.me/static/manual.pdf
#
# FIXME: Do not add the index file here; the result will be too big. Adding
# multiple PDF files here actually tries to get the cross-referencing right
# *between* PDF files.
pdf_documents = [
    ('kernel-documentation', u'Kernel', u'Kernel', u'J. Random Bozo'),
]

# kernel-doc extension configuration for running Sphinx directly (e.g. by Read
# the Docs). In a normal build, these are supplied from the Makefile via command
# line arguments.
kerneldoc_bin = '../scripts/kernel-doc'
kerneldoc_srctree = '..'

# ------------------------------------------------------------------------------
# Since loadConfig overwrites settings from the global namespace, it has to be
# the last statement in the conf.py file
# ------------------------------------------------------------------------------
loadConfig(globals())
Ejemplo n.º 4
0
import os
from googleapiclient.http import MediaFileUpload
import json
from load_config import loadConfig
from googleapiclient.errors import HttpError


# GLOBAL VARIABLES
base_path = None
ignore_config = loadConfig('ignore_config')

def existsInDrive(service, ftype, fname, parent):
	query = ''
	if ftype == 'file':
		query = "name = '{}' and mimeType != 'application/vnd.google-apps.folder' and '{}' in parents and trashed = false".format(fname, parent)
	elif ftype == 'folder':
		query = "name = '{}' and mimeType = 'application/vnd.google-apps.folder' and '{}' in parents and trashed = false".format(fname, parent)
	else:
		print["[ERROR] searching for invalid file type"]
		return -1

	try:
		response = service.files().list(q=query,
										spaces='drive',
										fields='files(id, name, trashed, parents)'
									).execute()

		# print(response.get('files', []))
		# for file in response.get('files', []):
		# 	print(file.get('id'), file.get('name'), file.get('trashed'))