【发布时间】:2014-03-19 01:27:44
【问题描述】:
我在网站上看到了一些试图帮助解决这个问题的东西,但我无法确定自己做错了什么。
这段代码应该获取关注者列表,但无论我尝试什么,我都会从 Twitter API 收到 429 错误:
def get_follow_list():
next_cursor = -1
while next_cursor != 0:
response = twitter.get_followers_list(screen_name=current_user, cursor=next_cursor)
following = response['users']
follow_list = [following]
time.sleep(1)
cursor = response['next_cursor']
return (follow_list)
我该如何解决这个问题?
编辑:给出的答案中的代码很棒,但是在尝试从中打印值时出现此错误:“UnicodeEncodeError: 'UCS-2' codec can't encode characters in position 205571-205571: Non-BMP Tk 中不支持的字符”。这反过来又会导致调用 GUI 类的问题,如前所述。我不确定如何将列表的编码更改为我的应用中的列表框可以处理的内容。
【问题讨论】: