小编Mom*_*omo的帖子

api = twitter.Api()AttributeError:'module'对象没有属性'Api

我一直试图写一个简单的提取抓取器来开始使用twitter Api.无论我在初始化Api时遇到了一些困难.在archlinux上运行python2我通过easy_install安装了twitter,从源代码构建并通过pip安装.这似乎都不起作用.

zergling :: ~/dev/kritter » python2
Python 2.7.2 (default, Jan 31 2012, 13:26:35) 
[GCC 4.6.2 20120120 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import twitter
>>> api = twitter.Api()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'Api'
Run Code Online (Sandbox Code Playgroud)

无论Twitter的pydoc是什么.我不知道我做错了什么.我希望你能提供帮助

更新: 我尝试使用twitter.api()而不是twitter.Api()得到以下错误:回溯(最近一次调用最后):文件"main.py",第8行,在api = twitter.api()TypeError:'module'对象不可调用

其他信息:

>>> print dir(twitter)
['NoAuth', 'OAuth', 'Twitter', 'TwitterError', 'TwitterHTTPError', 'TwitterResponse',  'TwitterStream', 'UserPassAuth', '__all__', '__builtins__', '__doc__', '__file__',  '__name__', …
Run Code Online (Sandbox Code Playgroud)

python api twitter archlinux

15
推荐指数
3
解决办法
3万
查看次数

标签 统计

api ×1

archlinux ×1

python ×1

twitter ×1