Googleドライブにファイルを作成するPythonプログラムを作成しようとしています。しかし、私はそれをしようとすれば、それはOAuth API GoogleドライブPython
'Your browser has been opened to visit:
()
https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&response_type=code&client_id=742339009631-b7rv2mnplb22rhdjb1m663aken700cfe.apps.googleusercontent.com&access_type=offline
()'
を言うそして、それはブラウザと私は、次の取得を開きます。
"
401. That’s an error.
Error: deleted_client
The OAuth client was deleted.
Request Details
scope=https://www.googleapis.com/auth/drive
redirect_uri=http://localhost:8080/
response_type=code
client_id=742339009631-b7rv2mnplb22rhdjb1m663aken700cfe.apps.googleusercontent.com
access_type=offline
That’s all we know."
Googleは新しいバージョンを持っていますか?それとも何が問題なの?
私のコードは次のとおりです。
Handling API Errorsから基づいfrom pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
gauth = GoogleAuth()
drive = GoogleDrive(gauth)
f = drive.CreateFile()
f.SetContentFile('hello.txt')
f.Upload()
print('title: %s, mimeType: %s' % (f['title'], f['mimeType']))
file_list = drive.ListFile({'q': "'root' in parents and trashed=false"}).GetList()
for file1 in file_list:
print('title: %s, id: %s' % (file1['title'], file1['id']))