Python tweepy错误。。方法不';不存在
我需要运行twitterapi调用来查找友谊。电话详情如下: 我在python中使用tweepy来实现这一点,但是tweepy中根本没有它。我做了一些挖掘,发现这个方法已经被添加到tweepy中,我有了最新的版本。选中此项:Python tweepy错误。。方法不';不存在,python,twitter,tweepy,Python,Twitter,Tweepy,我需要运行twitterapi调用来查找友谊。电话详情如下: 我在python中使用tweepy来实现这一点,但是tweepy中根本没有它。我做了一些挖掘,发现这个方法已经被添加到tweepy中,我有了最新的版本。选中此项: 每当我尝试运行api.lookup时。它不存在于代码中。有什么办法可以让它工作吗?您链接到的提交没有与tweepy主分支合并,直到,它是在。在1.12发布之前,您需要直接从git安装才能获得此功能* 要使用pip安装当前开发版本,请使用: pip install -e
每当我尝试运行api.lookup时。它不存在于代码中。有什么办法可以让它工作吗?您链接到的提交没有与tweepy主分支合并,直到,它是在。在1.12发布之前,您需要直接从git安装才能获得此功能* 要使用pip安装当前开发版本,请使用:
pip install -e git+https://github.com/tweepy/tweepy.git#egg=tweepy
运行该命令后,可以使用.lookup\u friendships()
方法:
>>> import tweepy
>>> api = tweepy.API()
>>> api.lookup_friendships
<bound method API.lookup_friendships of <tweepy.api.API object at 0x10a7ad290>>
>>> api.lookup_friendships()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/private/tmp/tweepy/src/tweepy/tweepy/api.py", line 285, in lookup_friendships
return self._lookup_friendships(list_to_csv(user_ids), list_to_csv(screen_names))
File "/private/tmp/tweepy/src/tweepy/tweepy/binder.py", line 184, in _call
method = APIMethod(api, args, kargs)
File "/private/tmp/tweepy/src/tweepy/tweepy/binder.py", line 34, in __init__
raise TweepError('Authentication required!')
tweepy.error.TweepError: Authentication required!
导入tweepy
>>>api=tweepy.api()
>>>api.U友谊
>>>api.lookup_friendships()
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“/private/tmp/tweepy/src/tweepy/tweepy/api.py”,第285行,在lookup\u friendships中
返回self.\u查找\u友谊(列表\u至\u csv(用户ID),列表\u至\u csv(屏幕名称))
文件“/private/tmp/tweepy/src/tweepy/tweepy/binder.py”,第184行,在调用中
方法=APIMethod(api、args、kargs)
文件“/private/tmp/tweepy/src/tweepy/tweepy/binder.py”,第34行,在__
raise TweepError('需要身份验证!')
tweepy.error.TweepError:需要身份验证!
我懒得登录;不过,上面的演示确实表明它是有效的。:-)
*版本1.12,包括这一更改,于2012年11月8日发布。您能否确认
python-c'导入tweepy;打印tweepy.\uuuuuu版本
为您提供1.11
?@Martijn Pieters另一个说明是,我在mac osx mountain lion上。tweepy的源文件位于哪里?我可以从git添加代码,不是吗?用bin/python-c'import-tweepy定位它;打印两个文件;我可以确认1.11缺少方法,奇怪。你能发布不起作用的示例代码吗?@AndreBossard:import tweepy;api=tweepy.api();api.lookup\u friendships()
->属性错误:“api”对象没有属性“lookup\u friendships”
。1.11发行版中包含的api.py
文件中没有定义此类函数。