gc = pygsheets.authorize(service_file='https://api.myjson.com/bins/******')
我现在尝试了这个,但我收到了这个错误:
FileNotFoundError: [Errno 2] No such file or directory: 'https://api.myjson.com/bins/******'
我怎样才能做到这一点?
gc = pygsheets.authorize(service_file='https://api.myjson.com/bins/******')
我现在尝试了这个,但我收到了这个错误:
FileNotFoundError: [Errno 2] No such file or directory: 'https://api.myjson.com/bins/******'
我怎样才能做到这一点?
当前的 pygsheets 期望 service_file 是一个文件。因此,您需要先下载远程文件,然后在 pygsheets 中使用它。
import requests
import pygsheets
image_url = "https://api.myjson.com/bins/******"
r = requests.get(image_url)
with open("service.json",'wb') as f:
f.write(r.content)
gc = pygsheets.authorize(service_file='service.json')