I'm have some problems with Google APIs Client Library for Python
. I can authenticate, create a drive instance and, for now, I just ask a list of all the files that I have in my drive:
drive_service = build('drive', 'v2', http_auth)
files = drive_service.files().list().execute()
This give me a dictionary, but I need a list. Then, I do:
result = []
result.extend(files['items'])
for item in files['items']:
print item['title']
print list(item['title'])
print type(item['title'])
and the out put is:
fotos.zip
[u'f', u'o', u't', u'o', u's', u'.', u'z', u'i', u'p']
<type 'unicode'>
But I need the list like this: [fotos.zip]
. I guess the problem is in the unicode
, but if I add this line at the first of script:
# -*- coding: utf-8 -*-
# code
print list(str(item['title']))
I have this error:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 6: ordinal not in range(128)
What's I can Do? Thanks!