Hi there,
Assuming you have provided the right Authorization Scope <https://developers.google.com/drive/v2/reference/permissions/get#auth> to access the Google Drive API, here is a method(adapted from this link <https://developers.google.com/drive/v2/web/quickstart/python>) to retrieve the id of the last file you uploaded: results = DRIVE.files().list(maxResults=1).execute() items = results.get('items', []) if not items: print('No files found.') else: print('Files:') for item in items: print('{0} ({1})'.format(item['title'], item['id'])) Note that this type of question is more appropriate for Stack Overflow which we regularly monitor as other types of stack exchange services and which would increase your chances to get a faster answer due to its larger audience. On Sunday, October 30, 2016 at 12:06:01 PM UTC-4, Rameez Raja wrote: > > I wrote a piece of code in python to upload a file to google drive, which > was successful. But I cant able to fetch the file id after the upload. > Could you guys please help me to get that. > > > . > . > . > DRIVE = build('drive', 'v2', http=http) > > FILES = ( > ('sample.csv', True), > ) > > for filename,convert in FILES: > metadata = {'title': filename} > res = DRIVE.files().insert(convert=convert, body=metadata, > media_body=filename,fields='mimeType').execute() > print(res) > print(a) > if res: > print('Uploaded "%s" (%s)' % (filename, res['mimeType'])) > > > > > Thank you > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-appengine. To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/1c06645d-6dc1-4e4d-80a3-5c24cdcc6a70%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
