是否有可能获得拥有超过一百万粉丝的账户的完整关注者列表,例如麦当劳?
我使用Tweepy并按照代码:
c = tweepy.Cursor(api.followers_ids, id = 'McDonalds')
ids = []
for page in c.pages():
ids.append(page)
Run Code Online (Sandbox Code Playgroud)
我也试试这个:
for id in c.items():
ids.append(id)
Run Code Online (Sandbox Code Playgroud)
但我总是得到'超出速率限制'错误,并且只有5000个关注者ID.
我是python的新手,我正在尝试使用库.它提出了一个例外,我试图找出哪一个.这就是我想要的:
except tweepy.TweepError as e:
print e
print type(e)
print e.__dict__
print e.reason
print type(e.reason)
Run Code Online (Sandbox Code Playgroud)
这就是我得到的:
[{u'message': u'Sorry, that page does not exist', u'code': 34}]
<class 'tweepy.error.TweepError'>
{'reason': u"[{u'message': u'Sorry, that page does not exist', u'code': 34}]", 'response': <httplib.HTTPResponse instance at 0x00000000029CEAC8>}
[{u'message': u'Sorry, that page does not exist', u'code': 34}]
<type 'unicode'>
Run Code Online (Sandbox Code Playgroud)
我试图达到那个代码.我试过e.reason.code没有成功,我不知道该尝试什么.
我正在使用tweepy制作推特应用程序.当用户发推文/更新个人资料等时,他们会收到一些错误.我想对错误进行分类并为用户提供更多信息.
try:
tweet/update profile/ follow....
except tweepy.TweepError, e:
if tweepy.TweepError is "Account update failed: Description is too long (maximum is 160 characters)"
Do something
if tweepy.TweepError is "Failed to send request: Invalid request URL: http://api.twitter.com/1/account/update_profile.json?location=%E5%85%B5%E5%BA%A"
Do something
if tweepy.TweepError is "[{u'message': u'Over capacity', u'code': 130}]"
Do something
Run Code Online (Sandbox Code Playgroud)
分类错误的唯一方法是e与字符串进行比较,例如,Account update failed: Description is too long (maximum is 160 characters)?