( 2017) ! , , API Google. . , .
API Google. (, Python pip install -U google-api-python-client [ pip3 Python 3].) list() - () main(), .
SCOPES = 'https://www.googleapis.com/auth/drive.readonly.metadata'
store = file.Storage('storage.json')
creds = store.get()
if not creds or creds.invalid:
flow = client.flow_from_clientsecrets('client_id.json', SCOPES)
creds = tools.run_flow(flow, store)
DRIVE = discovery.build('drive', 'v3', http=creds.authorize(Http()))
files = DRIVE.files().list().execute().get('files', [])
for f in files:
print(f['name'], f['mimeType'])
(, ..), API- Drive Python... :
(*) - TL; DR: , / Google, PDF. Drive API v2, ; Drive API v3, , " ".
, : , ( ), - (apiclient, oauth2client ..).). . , DRIVE apiclient.discovery.build(), , .files() .
Drive - , , ** * API, ( .files() build()). , API ( files()), about().get(), files().list(), files().export(), .. :
- ,
DRIVE, API ( , , DRIVE.files()). - API-, , API. .. files(), files(). get(), files(). list() .. " Python", , Python API , .
- API Drive .
: , - https://www.googleapis.com/auth/drive - , . MIMEtypes , . , , ? . , , , . , .
, storage.json .credentials/drive-credentials.json