he conseguido tanto leer los datos que hay en mi servidor de google drive y descargar archivos, pero no he conseguido como subir.(Todo esto a través de python)
Este es mi codigo ` from future import print_function import pickle import os.path from google_drive_downloader import GoogleDriveDownloader as gdd from googleapiclient.discovery import build from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests import Request from apiclient.http import MediaFileUpload
# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://www.googleapis.com/auth/drive.metadata.readonly']
def main():
file_metadata = {'Photho1': 'photo.jpg'}
media = MediaFileUpload('C:/Users/Jose Maria/Desktop/photo1.jpg', mimetype='image/jpeg')
file = drive_service.files().create(body=file_metadata,
media_body=media,
fields='id').execute()
main()`
Y me aparece es sigiente error:
raceback (most recent call last):
File "c:/Users/Jose Maria/Desktop/Programación/Python/Drive/Subir.py", line 20, in <module>
main()
File "c:/Users/Jose Maria/Desktop/Programación/Python/Drive/Subir.py", line 16, in main
file = drive_service.files().create(body=file_metadata,
NameError: name 'drive_service' is not defined