[英]Attribute Error: 'module' object has no attribute 'Oauth'
我正在尝试使用DS18b20温度传感器设置温度记录器。 我一直在“ Raspberry Pi傻瓜项目”一书的第10章中进行操作。 在Googledocs中创建温度记录器电子表格后,下一步是将我的Raspberry Pi记录的数据存储到保存在GoogleDocs上的温度记录电子表格中。 我已经创建了电子表格,下载了必备程序templogger_gdocs.py,ds18b20.py和gdocs.py。 我运行了emplogger_gdocs.py程序,并输入了客户端ID,密钥和电子表格密钥,并保存了更改。 我已经仔细检查过错别字。 然后,我应该输入“ python templogger_gdocs.py,它应该带我到www.google.com/device并给我一个代码,但我得到以下信息:
**Traceback (most recent call last):
File "templogger_gdocs.py", line 58, in <module>
main()
File "templogger_gdocs.py", line 48, in main
LogRowInGDocSpreadsheet(client_id, client_secret, spreadsheet_key, headings, temperature, unit_of_measure);
File "/root/rpipfd/gdocs.py", line 14, in LogRowInGDocSpreadsheet
oauth = gaugette.oauth.OAuth(CLIENT_ID, CLIENT_SECRET)
AttributeError: 'module' object has no attribute 'OAuth'
我的问题是如何获取代码所需的OAuth模块?
从最近两天的研究来看,我似乎也需要令牌。 我有这个,但是我不知道在哪里输入。
下面(以!/ usr / bin / env。开头)是运行templogger_gdocs.py程序时得到的信息。
!/usr/bin/env python
"""
Rapsberry Pi Projects For Dummies: temperature logger to google docs spreadsheet
For the Raspberry Pi
"""
import subprocess
import time
from ds18b20 import GetTemperature
from gdocs import LogRowInGDocSpreadsheet
ds18b20_dir = "XXXXX"
client_id = "XXXXX"
client_secret = "XXXXX"
spreadsheet_key = "XXXXX"
fahrenheit = False
headings = ["Temperature", "Date", "Unit"] #column headings can't have
spaces
def main():
# This is the main routine of the program
# set how long to wait between logs
poll_interval = 5
if fahrenheit:
unit_of_measure = 'F'
else:
unit_of_measure = 'C'
我觉得它需要更新。 该书于2015年出版,可能已经过时。 似乎现在有一个OAuth2和一个json令牌。
您认为需要oauth2是正确的。 我建议改用gdata库。 我什至找不到gdocs库上的文档。 另外,还有sheets API。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.