我已经为python编写了一个使用twython的小脚本,它随机地取消了人们的跟踪,但是,每当我运行代码时,都不会发生任何事情。
mfriends = twitter.get_followers_ids(screen_name='myscreenname', count=50)
try:
for unfollo in mfriends ['ids']:
twitter.destroy_friendship(user_id=unfollo)
except TwythonError as e:
print(e)发布于 2015-05-13 03:15:20
您需要修复try/syntax(无效语法):
from twython import Twython, TwythonError
app_key = 'your_key'
app_secret = 'your_secret'
oauth_key = 'your_oauth_key'
oauth_secret = 'your_oauth_secret'
twitter = Twython(app_key, app_secret, oauth_token, oauth_token_secret)
mfriends = twitter.get_followers_ids(screen_name='myscreenname', count=50)
try:
for unfollo in mfriends['ids']:
twitter.destroy_friendship(user_id=unfollo)
except TwythonError as e:
print(e)https://stackoverflow.com/questions/28922221
复制相似问题