USING: Windows7, Python 2.7, Google App Engine
Google's documentation for inserting(creating) a file to Google Drive using Python and the Drive API. Here is the link showing the code near the bottom of the page:
Write a file to a Google Drive using Python
A function named: insert_file
is defined in the Python module.
def insert_file(service, title, description, parent_id, mime_type, filename):
The insert_file
function takes 6 arguments passed into it. The first arg is service
.
In the comment section of the example code, it is indicated that the service
arg takes the Drive API service instance
as the input.
Args:
service: Drive API service instance. title: Title of the file to insert, including the extension. description: Description of the file to insert. parent_id: Parent folders ID. mime_type: MIME type of the file to insert. filename: Filename of the file to insert.
What is the Drive API service instance
? I have no idea what that is or what the valid settings are. Is it the authorization scope that is expressed as a URL? I do know what the title
and description
are. The title is the new name of the file being written, and the description is a detail, presumably put into the files metadata. I'm not sure how to get the parent_id
or the Parent folder
either. How is that info obtained? Do I get that manually from Google Drive? I know what the MIME type setting is.
If someone could give an explanation of what the Drive API service instance
is, and give an example, that would be great. I did a search for Drive API service instance
, and couldn't find an explanation. I searched the internet. I searched Google Developers. I found nothing.