GithubHelp home page GithubHelp logo

thanhtoan1196 / gdriveusinggcolab Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pcodejs/gdriveusinggcolab

0.0 1.0 0.0 18 KB

Download Anything to Google Drive using Google colab

Jupyter Notebook 100.00%

gdriveusinggcolab's Introduction

When we download/upload something from a cloud server, it gives more transfer rate as compared to a normal server. We can use Google Drive for storage as well as fast speed download. The problem is how to upload something to G-Drive direct from Internet. So, Here we will see a solution to upload anything to Google drive directly from Internet.

All we need is google account and a few lines of code.

Colab Google

Google Colab is a free cloud service with GPU support. It is like Jupyter Notebook and very simple to use. In this tutorial, we will be using Google Colab to download anything to our google drive.

Step #1 : Sign in to Google Colab and Create a new Python3 notebook. Atom

Atom

Step #2 : Importing google drive to colab

To import google drive, write this code in code section of colab and run it by Ctrl+Enter .

from google.colab import drive
drive.mount( '/content/gdrive' )

Atom

Atom

On running code, one blue link and a text box will appear we need to provide a permission text. So click the link and a new tab will open where you will be asked for permission to access google drive. After providing permissions a text will be displayed that we need to Copy and paste on colabs text box.

Atom

Paste text in box and press enter. That all to import gdrive. We can see google drive on Left side Panel.

Atom

Step #3 : Download something to Google Drive

To download something all we need is URL to downloadable file.

import requests
file_url = "http://1.droppdf.com/files/5iHzx/automate-the-boring-stuff-with-python-2015-.pdf"
r = requests.get(file_url, stream = True)
with open("/content/gdrive/My Drive/python.pdf","wb") as file:
  for block in r.iter_content(chunk_size = 1024):
    if block:
      file.write(block)

Atom

We can see on the left side panel that pdf file is downloaded.

Conclusion:

We can use google colab to download any file on google drive.

As you can see a folder parrot (parrot OS of 3.7 GB ), downloaded to gdrive using Colab.

Material source:Geeks for Geeks

gdriveusinggcolab's People

Contributors

pcodejs avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.