Я использую pydrive на удаленном сервере (pythonanywhere), когда я запускаю код, который запрашивает код подтверждения, и когда я предоставляю код, я получаю следующую ошибку
Go to the following link in your browser:
https://accounts.google.com/o/oauth2/auth?client_id=685978119888-2fbsd3hmbmdjf11l976t1bma0thepekl.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.google
apis.com%2Fauth%2Fdrive&access_type=offline&response_type=code
Enter verification code: 4/wwGmzGdLZlTik2zijZS4fjzAfbt-JvstslPApcT68rcnL2ObgW9EKg0
выше - это блок проверки. я получаю следующую ошибку при вводе кода
Traceback (most recent call last):
File "/home/hedihadi/aw.py", line 18, in
uploadimg("h","h","e")
File "/home/hedihadi/aw.py", line 7, in uploadimg
gauth.CommandLineAuth() # <--
File "/home/hedihadi/.local/lib/python3.7/site-packages/pydrive/auth.py", line 125, in _decorated
self.Auth(code)
File "/home/hedihadi/.local/lib/python3.7/site-packages/pydrive/auth.py", line 495, in Auth
self.Authenticate(code)
File "/home/hedihadi/.local/lib/python3.7/site-packages/pydrive/auth.py", line 508, in Authenticate
self.credentials = self.flow.step2_exchange(code)
File "/usr/lib/python3.7/site-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/lib/python3.7/site-packages/oauth2client/client.py", line 2054, in step2_exchange
http, self.token_uri, method='POST', body=body, headers=headers)
File "/usr/lib/python3.7/site-packages/oauth2client/transport.py", line 282, in request
connection_type=connection_type)
File "/usr/lib/python3.7/site-packages/httplib2/init.py", line 1957, in request
cachekey,
File "/usr/lib/python3.7/site-packages/httplib2/init.py", line 1622, in _request
conn, request_uri, method, body, headers
File "/usr/lib/python3.7/site-packages/httplib2/init.py", line 1528, in _conn_request
conn.connect()
File "/usr/lib/python3.7/site-packages/httplib2/init.py", line 1309, in connect
sock.connect((self.host, self.port))
File "/usr/lib/python3.7/site-packages/socks.py", line 406, in connect
self.__negotiatehttp(destpair[0],destpair[1])
File "/usr/lib/python3.7/site-packages/socks.py", line 357, in __negotiatehttp
while resp.find("\r\n\r\n")==-1:
TypeError: argument should be integer or bytes-like object, not 'str
, это мой aw.py
файл, где я запускаю код и получаю ошибку
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
def uploadimg(kart, band, fraction):
gauth = GoogleAuth()
gauth.CommandLineAuth() # <--
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")