Google drive API part2 : uploading large file

from googleapiclient.http import MediaFileUpload
# get filename from argumentthe_file_to_upload = sys.argv[1]metadata = {'name': the_file_to_upload}media = MediaFileUpload(the_file_to_upload,    chunksize=5 * 1024 * 1024,    mimetype='application/octet-stream',    resumable=True)request = service.files().create(body=metadata, media_body=media)response = Nonewhile response is None:    status, response = request.next_chunk()    if status:        print("Uploaded %d%%." % int(status.progress() * 100))
print("Upload of {} is complete.".format(the_file_to_upload))

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

But it works in my Environment - Tips for writing scripts someone else will run

GSoC 2017 — Apache VXQuery RESTful API

Dialogflow Tutorial: Back Functionality in Chatbot using Python + Django

IVS-Weekly Updates — January 8th- January 14th

Use Of Keywords And Identifiers

Configuration of webserver on docker container using Ansible playbook

Basic GIT Commands (Ba-GIT)

Tuple Functions in Python

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
haRies Efrika

haRies Efrika

More from Medium

leetcode 162. Find Peak Element

Options For Building Real-time Apps

A beginner guide of Apache ECharts

TOP 15 Questions and answers to automation testing interview