我刚刚开始使用Google Drive API,目前正在使用google开发人员页面上的示例代码,但是,它不起作用并返回HttpError。
import pandas as pd
import matplotlib.pyplot as plt
df1 = pd.DataFrame({
'pig': [[20, 18, 489, 675, 1776],[20, 18, 489, 675, 1776]],
'horse': [[14, 25, 271, 700, 1900],[14, 65, 381, 600, 1900]]},
index=['A','B']
)
for idx in df1.index.values:
plt.plot(df1['pig'].loc[idx], df1['horse'].loc[idx], label=idx)
plt.legend()
plt.xlabel('Pig')
plt.ylabel('Horse')
plt.show()
我希望示例代码现在可以将期望的文件下载到.py文件所在的位置,但是它返回:
file_id = '1uqJgJ5UTLPtxYH-_nW4Ck9an_ywLcZoCKmvQBkxKR5Y'
request = service.files().export_media(fileId=file_id,
mimeType='text/csv')
fh = io.BytesIO()
downloader = MediaIoBaseDownload(fh, request)
done = False
while done is False:
status, done = downloader.next_chunk()
print("Download %d%%." % int(status.progress() * 100))