Created
May 21, 2020 18:26
-
-
Save userddssilva/55fa4d83b39e3d71e9216b305984f342 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@title Download Dataset to Google Colab { form-width: "800px" } | |
# e.g GOOGLE_DRIVE_FILE_URL: https://drive.google.com/open?id=1CZyDkHHjS8SUVBF7fBwoTAF6xSpLmD4P7 | |
LinkFile = "https://drive.google.com/open?id=1ZKGI0xYnBWYpSf13fbmVTnIxBa6cTQyH" #@param {type:"string"} | |
# e.g GOOGLE_DRIVE_FILENAME_WITH_EXTENSION: Local History.csv | |
Filename = "codebench.zip" #@param {type:"string"} | |
Filename = Filename.replace(' ', '\ ') | |
# Install the PyDrive wrapper & import libraries. | |
# This only needs to be done once per notebook. | |
!pip install -U -q PyDrive | |
from pydrive.auth import GoogleAuth | |
from pydrive.drive import GoogleDrive | |
from google.colab import auth | |
from oauth2client.client import GoogleCredentials | |
# Authenticate and create the PyDrive client. | |
# This only needs to be done once per notebook. | |
auth.authenticate_user() | |
gauth = GoogleAuth() | |
gauth.credentials = GoogleCredentials.get_application_default() | |
drive = GoogleDrive(gauth) | |
# Download a file based on its file ID. | |
# | |
# A file ID looks like: laggVyWshwcyP6kEI-y_W3P8D26sz | |
file_id = LinkFile.split('=')[-1] | |
downloaded = drive.CreateFile({'id': file_id}) | |
downloaded.GetContentFile(Filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
script to downloading file of Google Drive