我试图编译fatsecret在github中的开发者共享的example.py。但我犯了个错误
示例.py:
fs=Fatsecret(consumer_key,consumer_secret)
saved_meals=fs.saved_meals_get()
print saved_meals
result=fs.foods_search("Betty")
print result
API:
self.oauth=OAuth1Service(
name='fatsecret',
consumer_key=consumer_key,
consumer_secret=consumer_secret,
request_token_url='http://www.fatsecret.com/oauth/request_token',
access_token_url='http://www.fatsecret.com/oauth/access_token',
authorize_url='http://www.fatsecret.com/oauth/authorize',
header_auth=False)
并得到如下错误消息:
File "example.py", line 11, in <module>
fs=Fatsecret(consumer_key,consumer_secret)
File "C:\Users\Zharfan Akbar\haha\pyfatsecret\fatsecret.py", line 22, in __init__
header_auth=False)
TypeError: __init__() got an unexpected keyword argument 'header_auth'
这是到githubHere的链接
您正在使用的回购将指导您查看https://github.com/litl/rauth 要了解OAuth1Service是如何工作的,在该repo中,您可以看到API已更改为
OAuth1Service( name='twitter', consumer_key='J8MoJG4bQ9gcmGh8H7XhMg', consumer_secret='7WAscbSy65GmiVOvMU5EBYn5z80fhQkcFWSLMJJu4', request_token_url='https://api.twitter.com/oauth/request_token', access_token_url='https://api.twitter.com/oauth/access_token', authorize_url='https://api.twitter.com/oauth/authorize', base_url='https://api.twitter.com/1.1/')
所以您要么使用旧版本的OAuth,要么更新Fatsecret(这是6年前的版本!)
相关问题 更多 >
编程相关推荐