Katieeliselambert - Nơi chia sẻ thật nhiều tin hot thú vị trong ngày
  • Home
  • Công Nghệ
  • Máy Tính
  • Phần Mềm
No Result
View All Result
  • Home
  • Công Nghệ
  • Máy Tính
  • Phần Mềm
No Result
View All Result
Katieeliselambert - Nơi chia sẻ thật nhiều tin hot thú vị trong ngày
No Result
View All Result

Google Drive API: Uploading & Downloading Files

admin by admin
June 1, 2020
in Tổng Hợp
34
Google Drive API: Uploading & Downloading Files



In a short dozen minutes, Google engineer Wesley Chun guides you through this jam-packed episode featuring an introduction to the new Drive API (v3), an interview with a Google Drive engineer about the API design, and a code walkthrough of real source code you can use today! This time, it’s a command-line script that performs Drive file uploads & downloads, presented first in the original API (v2) followed by a how-to segment on migrating it step-by-step to the new API (v3). In addition, the uploading segment includes the option of converting to Google Apps formats while the download portion covers exporting to alternative formats such as PDF®.

Links from the episode:

* Google Drive new API launch:
* Google Drive API original launch:
* Client Library supported languages:
* Google APIs common code walkthrough:
* Migrating from run() to run_flow():
* Optimizing Drive API calls:
* Google Drive API documentation:
* Code Samples blogpost:
* Launchpad Online developer video series:
* Listing your files in Google Drive:
* File Storage in the Cloud:
* Accessing Google APIs:

Subscribe to the Google Developers channel at –
Subscribe to the brand new Firebase Channel:

Nguồn: https://katieeliselambert.com

Xem thêm bài viết khác: https://katieeliselambert.com/tong-hop/

Xem thêm Bài Viết:

  • Cơ hội và thách thức từ ý tưởng kinh doanh cho thuê nhà Bắc Ninh
  • Chỉ với 3 bước chuyển nhượng Vinhomes Grand Park quận 9 dễ dàng
  • Nên tìm phòng trọ giá rẻ trực tiếp hay gián tiếp?
  • Hướng dẫn cách tải Gcafe 2017 cho FIFA online chi tiết và nhanh chóng
  • Cài Gcafe miễn phí || Key tháng 7+8+9/2017 || Hướng dẫn chi tiết
Previous Post

AOE 2: Việt Nam vs Trung Quốc vs Nhật Bản

Next Post

PHIM THẦN THOẠI KINH DỊ MỸ CỰC HAY - CHIẾN THẦN FULL HD - phim thần thoại kinh dị hay nhất

Next Post
PHIM THẦN THOẠI KINH DỊ MỸ CỰC HAY – CHIẾN THẦN FULL HD – phim thần thoại kinh dị hay nhất

PHIM THẦN THOẠI KINH DỊ MỸ CỰC HAY - CHIẾN THẦN FULL HD - phim thần thoại kinh dị hay nhất

Comments 34

  1. Harry Lukeides says:
    3 years ago

    Harry Lukeides : I have a project with youtube through Google to be able to watch or down load Info. I can not download an api file . I am 80 years old Do I have to go to Uni to learn all about computers, or is there a samaritan to help me out, I process a project No. and an id with google ;

    Reply
  2. Kapil Chhabria says:
    3 years ago

    Praise the baby jesus! found this just in time. Thank you for walking us through the code, for the dullards such as I, this is most useful.

    Reply
  3. ANAND RAJU says:
    3 years ago

    @google developers, this doesn't work for the shared drives.

    Reply
  4. Akshatha Laxmi says:
    3 years ago

    I copied the exact same code but I was getting the following error:
    raise HttpError(resp, content, uri=self.uri)

    googleapiclient.errors.HttpError: <HttpError 403 when requesting https://www.googleapis.com/upload/drive/v3/files?alt=json&uploadType=multipart returned "Insufficient Permission: Request had insufficient authentication scopes.">

    What should I do to fix it?

    Reply
  5. Iwan Krisnawan says:
    3 years ago

    hey bro, do you know how to add caption track video (vtt) on google drive with coding ?

    Reply
  6. Ghundi says:
    3 years ago

    Can you tell me whats the content of storage.json ???

    Reply
  7. Legnahar Prime says:
    3 years ago

    Is it possible to do smth like this in C++ ?

    Reply
  8. ศราวุธ เหล่าบุรมย์ says:
    3 years ago

    Why php download code
    Fatal error: Uncaught exception 'Google_Service_Exception' with message '{

    "error": {

    "errors": [

    {

    "domain": "global",

    "reason": "fileNotExportable",

    "message": "Export only supports Google Docs."

    }

    ],

    "code": 403,

    "message": "Export only supports Google Docs."

    }

    }

    ' in C:AppServwwwgooglevendorgoogleapiclientsrcGoogleHttpREST.php:118

    Stack trace:

    #0 C:AppServwwwgooglevendorgoogleapiclientsrcGoogleHttpREST.php(94): Google_Http_REST::decodeHttpResponse(Object(GuzzleHttpPsr7Response), Object(GuzzleHttpPsr7Request), NULL)

    #1 [internal function]: Google_Http_REST::doExecute(Object(GuzzleHttpClient), Object(GuzzleHttpPsr7Request), NULL)

    #2 C:AppServwwwgooglevendorgoogleapiclientsrcGoogleTaskRunner.php(181): call_user_func_array(Array, Array)

    #3 C:AppServwwwgooglevendorgoogleapiclientsrcGoogleHttpREST.php(58): Google_Task_Runner->run()

    #4 C:AppServwwwgooglevendorgoogleapiclientsrcGoogleClient.php(779): Google_Http_REST::execute(Object(GuzzleHttp in C:AppServwwwgooglevendorgoogleapiclientsrcGoogleHttpREST.php on

    Reply
  9. Nishant Srivastav says:
    3 years ago

    How can we upload files in team drive?

    Reply
  10. Jamshaid Kamran says:
    3 years ago

    So, I am supposed to upload videos files greater than several hundred MBs, So, to upload them I am first calling my server side code of C# asp.net and then handing over the file to google drive. Isn't any direct way of uploading files? javascript for asp.net servers? No?

    Reply
  11. prakhar patidar says:
    3 years ago

    How to download already existing video files in drive? any initial thought?

    Reply
  12. mogum loyi mogum Loyi says:
    3 years ago

    Whatever it May be it's a better lesson for everyone's to understand the living stength of human beings and a life of others need.

    Reply
  13. mogum loyi mogum Loyi says:
    3 years ago

    Whatever it May be it's a better lesson for everyone's to understand the living stength of human beings and a life of others need.

    Reply
  14. Young Nam says:
    3 years ago

    WHY DIS CODE NOT ON DOCUMENTATION!?!?!?!?!?!!?!?!?!!?

    Reply
  15. Hit says:
    3 years ago

    I was waiting for him to say python

    Reply
  16. Sharath Chandra says:
    3 years ago

    Is there a video to achieve same using Javascript?

    Reply
  17. CoreCx says:
    3 years ago

    this api is bat shit insane .

    Reply
  18. Ja Ke says:
    3 years ago

    see at 3:16.

    Reply
  19. Marina Doria says:
    3 years ago

    I run the same code and I had these errors: Can you help me please?

    Traceback (most recent call last):
    File "c:update_costsuploader.py", line 32, in <module>
    res = DRIVE.files().create(body=metadata, media_body=filename).execute()
    File "C:UsersllollAnaconda3libsite-packagesgoogleapiclientdiscovery.py", line 811, in method
    mimetype=media_mime_type)
    File "C:UsersllollAnaconda3libsite-packagesoauth2client_helpers.py", line 133, in positional_wrapper
    return wrapped(*args, **kwargs)
    File "C:UsersllollAnaconda3libsite-packagesgoogleapiclienthttp.py", line 550, in _init_
    fd = open(self._filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: 'hello.txt'

    Reply
  20. Thoại Ngô says:
    3 years ago

    hi, how get link mp3 in google drive?r, thanks admin

    Reply
  21. Raymond Khozanai Mlambo says:
    3 years ago

    I cant seem to get this right. It keeps throwing errors for me. Here is the error message
    CODE:
    from _future_ import print_function
    import os

    from apiclient import discovery
    from apiclient.discovery import build
    from httplib2 import Http
    from oauth2client import file, client, tools

    try:
    import argparse
    flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args()
    except ImportError:
    flags = None

    SCOPES = 'https://www.googleapis.com/auth/drive.file'
    store = file.Storage('storage.json')
    creds = store.get()
    if not creds or creds.invalid:
    flow = client.flow_from_clientsecrets('client_secret.json', scope=SCOPES)
    creds = tools.run_flow(flow, store, flags)
    if flags else tools.run(flow, store)

    DRIVE = build('drive', 'v3', http=creds.authorize(Http()))

    FILES = (
    ('hello.txt', None),
    ('hello.txt', 'application/vnd.google-apps.document')
    )

    for filename, mimeType in FILES:
    metadata = {'name': filename}
    if mimeType:
    metadata['mimeType'] = mimeType

    res = DRIVE.files().create(body=metadata, media_body=filename).execute()
    if res:
    print('Uploaded "%s" (%s) ' % (filename, res['mimeType']))

    if res:
    MIMETYPE = 'application/pdf'
    data = DRIVE.files().export(fileId=res['id'], mimeType=MIMETYPE).execute()
    res, data = DRIVE._http.request(res['exportLinks'][MIMETYPE])
    if data:
    fn = '%s.pdf' % os.path.splitext(filename)[0]
    with open(fn, 'wb') as fh:
    fh.write(data)
    print('Downloaded "%s" (%s)' % (fn, MIMETYPE))

    ERROR:

    /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 /Users/raymondm/PycharmProjects/HelloWorld/Demos/v3_download_files.py
    Traceback (most recent call last):
    File "/Users/raymondm/PycharmProjects/HelloWorld/Demos/v3_download_files.py", line 35, in <module>
    res = DRIVE.files().create(body=metadata, media_body=filename).execute()
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/googleapiclient/discovery.py", line 815, in method
    mimetype=media_mime_type)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
    return wrapped(*args, **kwargs)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/googleapiclient/http.py", line 548, in _init_
    fd = open(self._filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: 'hello.txt'

    Reply
  22. Geir Skårhaug says:
    3 years ago

    This was really expiring! Thanks a bunch!

    Reply
  23. ABCDE says:
    3 years ago

    Google Drive API is hard to integrate in iOS.
    https://github.com/google/google-api-objectivec-client-for-rest/issues
    lots of issue not solve. Developers need to take a lot of time to solve these issues.

    Reply
  24. tiska hardiana says:
    3 years ago

    Hello Mr. Wesley Chun
    My name is Tiska, i'm a college student. Recently I'm learning Google Drive API and I'm interested to learn more, because i want to develop the google drive apps for research in my college. would you mind to answering some question about drive API?
    and may i know your personal email account?
    thank you ^.^

    Reply
  25. Joseph Kreifels II says:
    3 years ago

    Where do you download the API for linux systems, and can it be done using a simpler language? Like Java?

    Reply
  26. wei48221 says:
    3 years ago

    Great tutorial!! Love it..

    Reply
  27. Ownage Juice says:
    3 years ago

    Wesley Chun rocks! m/

    Reply
  28. Ownage Juice says:
    3 years ago

    in DriveV2, you can export Google Docs using the exportLinks? Now in DriveV3, using the TRY-IT, it only returns the MiMETYPE and no exportlinks. How is this easier for developers?

    Reply
  29. Christopher Riewaldt says:
    3 years ago

    I wish would have found this hours ago! Thank you!

    Reply
  30. HawksGaze says:
    3 years ago

    I have problems about downloading!In Python My code falls in service.files().export  with message export 'only supports google docs'.In my drive i have a xls . Try with pdf mime type (i assume convert xls->pdf), tried with xlsx, xls and a spreadsheet as mimetype too.

    Reply
  31. 박재일 says:
    3 years ago

    how can i use in appinventor?

    Reply
  32. Никита Лебедев says:
    3 years ago

    how do this on C#?

    Reply
  33. Exélixis says:
    3 years ago

    I love Python 3 and Google, too bad Google stays mostly with Python 2.

    Reply
  34. Ryan Sampaio Filho says:
    3 years ago

    nice

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Tin Hot

Xe máy điện VinFast Evo có thời gian sạc tiêu chuẩn là 10 tiếng cho vận tốc cực đại 70km/h với mức công suất 1.500W (Nguồn: vnexpress.net)

Hiện nay những dòng xe máy điện nào hoạt động tốt nhất tại Việt Nam

August 2, 2022
Nhiều cơ sở kinh doanh có thiết bị kiểm định tuổi vàng có vấn đề

Coi Chừng Những Mánh Lừa Khi Mua Vàng Trang Sức

December 8, 2021
Máy hấp giò chả 12 khay cho năng suất cao, thời gian hấp nhanh chóng

Chia sẻ bí quyết hấp giò chả bằng tủ hấp giò chả 12 khay

September 22, 2021
Cách mở sim mobiphone bị khóa 2 chiều đơn giản, nhanh chóng

Xem Ngay Cách Mở Sim mobiphone bị khóa 2 chiều

September 12, 2021
Những bức tranh con ngựa đẹp tại Phúc Tường Gold

Những bức tranh con ngựa đẹp tại Phúc Tường Gold

August 3, 2021
6 lợi ích tuyệt vời khi sử dụng tủ nấu cơm công nghiệp

6 lợi ích tuyệt vời khi sử dụng tủ nấu cơm công nghiệp

August 3, 2021
  • Liên Hệ
  • Chính Sách Bảo Mật

© 2022 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Công Nghệ
  • Máy Tính
  • Phần Mềm

© 2022 JNews - Premium WordPress news & magazine theme by Jegtheme.