使用tweepy从twitter时间线获取状态时出错

时间:2014-07-17 07:08:41

标签: python twitter tweepy

我是tweepy的新手,我正在尝试使用tweepy获取我的Twitter时间线状态。当我重复分页时,我遇到了错误。

Traceback (most recent call last):
  File "D:\Workspace\newtwiiter\test.py", line 17, in <module>
    for page in tweepy.Cursor(api.user_timeline, count=200).pages(15):
  File "D:\Workspace\newtwiiter\tweepy\cursor.py", line 101, in next
    old_parser = self.method.__self__.parser
AttributeError: 'function' object has no attribute '__self__'

这是我的代码,

import tweepy
consumer_key='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
consumer_secret='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
access_token_key='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
access_token_secret='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token_key, access_token_secret)
api = tweepy.API(auth)

page_list=[]
for page in tweepy.Cursor(api.user_timeline, count=200).pages(15):
    page_list.append(page)

for page in page_list:
    for status in page:
       print status.text

我在这里做错了什么?

1 个答案:

答案 0 :(得分:0)

此问题是由于某些预安装软件包的冲突引起的。当我尝试在virtualenv中运行此脚本时,它会在没有任何错误的情况下执行。