在浏览器中打开JavaScript以继续

2024-09-21 05:30:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我在pythonanywhere上使用python3.6,当我尝试运行pydrive(自动将文件上载到google drive)时,我收到以下错误:-

You've reached this page because we have detected that Javascript is disabled in your browser. The page you attempted to load cannot display properly if scripts are disabled.                               

   Please enable scripts and retry the operation or go back in your browser.

它要求我登录我的gmail帐户,所以我认为这就是问题所在,我如何解决这个问题

这是我的全部代码

from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive


def uploadimg(kart, band, fraction):
    gauth = GoogleAuth()
    gauth.LoadCredentialsFile("mycreds.txt")
    if gauth.credentials is None:
        gauth.LocalWebserverAuth()
    elif gauth.access_token_expired:
        gauth.Refresh()
    else:
        gauth.Authorize()
    # Save the current credentials to a file
    gauth.SaveCredentialsFile("mycreds.txt")
    drive = GoogleDrive(gauth)
    ######################

    file1 = drive.CreateFile({'title': "lqi"+fraction+"bandi"+band+"karti"+kart})
    file1.SetContentFile("hi.jpg")
    file1.Upload()

    file3 = drive.CreateFile({'id': file1['id']})

uploadimg("h","h","e")

Tags: thetoinfrombrowseryourifis

热门问题