WHT

Python Upload File To Google Drive | Google Drive Api In Python | Upload Files

Jie Jenn

Subscribe Here

Likes

172

Views

10,200

Google Drive Api In Python | Upload Files

Transcript:

[MUSIC] Hey, how soon guys welcome to another? Google Drive API in Python Tutorial by name and J in this video. I’m going to show you how to use Google Drive API to upload files to your Google. Drive folder. So for this video. I’m going to show you how to upload these two files once excel file and the align is an image file to this our render files. Google Drive folder. Let’s go into our Python editor. Here’s the code to create the Google Drive API service instance, and if we go to the documentation to upload a file, I’ll be using the files resource. Darkrai method in the maximum file size is 5,000 120 gigabytes in below some of the parameters and the request body information, which I’ll link the link in the description below. So you can go through the information on your own. Now, let’s go back to the Python script. The first thing we need to figure is which folder you want to upload our files to see. Let me go back to my Google Drive. I want to upload my files to the render files folder. Some come to go into that folder If we look at the URL In his the Google Drive folder. Id and come to copy this. Id and going to stood ID in your vehicle. I’m going to name this variable folder Id. And because these two files have two different extension types. So I’m going to create two Lissas for the first list. I’m going to name this list. File names and the second list is going to be file types. I’m going to grab the file name for both files. Now store the file names in the file names list for the file types. I should let me rename these to mime types for the mime types here on my website. I have a table that lists all the mime types for almost every single file type If I search for Excel SX, and it’s gonna be the Microsoft Excel file type, and we know this extension belongs to excel file type and we’re going to just grab the might type value in consecrate function to detect the extension type and returns the mic type for now to keep everything easy. I’m just going to show you the basic steps. Now we know the second file is an image file. Some research for JPG image is the mime type for JPEG. I’m going to copy this text right here. No need to hear a each element in the filename’s list. I’m going to say that full file name in file names. I’m going to create the sure to store the metadata. I am named this dictionary. File made our data and we need to provide the name since we’re uploading the files to the random files for nineties format. This one to this random files folder. So I need to provide the parent’s parameter and its cumulus. Now insert the photo. I’d be able and to converge file to PI strings so here. I’m going to import another function from Google API client that HTTP don’t import classic of media file. Upload, lets. Go back to the loop here. Insert the media file upload class. How into the file path in the files are on the random files. Folder enemy grabbed for the name. I also need to provide them my type. Oh, so here I made a mistake. I should use the zip function to zip the file names and the mic types together so will be for filename and my type and for the mic type parameter. I can assign the mic type object. I was through the output to an object called media and I can upload the files by inserting the service object the files. Darkrai you need to assign the file metadata object to the body parameter for the media of body pronto. I will send the media object. You need to specify the fierce who’s gonna be Id to a secure. Now if I runs good, hoping I’m getting a attribute error when you see this attribute most likely is the file path is incorrect. So Hugh means a period when we try again in this time, the skill was able to Asakusa Sisley. Now, if I go back to my Google Drive and here’s the excel file and here’s the image file. Now If I just double. Click on the image file in this file is uploaded successfully, so the same thing I want to share in this video and hopefully you guys found the video useful in the Sois. Some you guys watching. I’ll see you guys on the next video.

0.3.0 | Wor Build 0.3.0 Installation Guide

Transcript: [MUSIC] Okay, so in this video? I want to take a look at the new windows on Raspberry Pi build 0.3.0 and this is the latest version. It's just been released today and this version you have to build by yourself. You have to get your own whim, and then you...

read more