File tree 2 files changed +27
-1
lines changed
2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change
1
+ import twitter
2
+
3
+
4
+ TWITTER_CONSUMER_KEY = 'XXX'
5
+ TWITTER_CONSUMER_SECRET = 'XXX'
6
+ TWITTER_ACCESS_TOKEN_KEY = 'XXX'
7
+ TWITTER_ACCESS_TOKEN_SECRET = 'XXX'
8
+
9
+ twitter_api = twitter .Api (
10
+ consumer_key = TWITTER_CONSUMER_KEY ,
11
+ consumer_secret = TWITTER_CONSUMER_SECRET ,
12
+ access_token_key = TWITTER_ACCESS_TOKEN_KEY ,
13
+ access_token_secret = TWITTER_ACCESS_TOKEN_SECRET
14
+ )
15
+
16
+ if __name__ == '__main__' :
17
+ follower_ids = twitter_api .GetFollowerIDs ()
18
+ following_ids = twitter_api .GetFriendIDs ()
19
+ zombie_follows = [following_id for following_id in following_ids if following_id not in follower_ids ]
20
+
21
+ confirm = raw_input ("Are you sure you want to unfollow %s tweeps [y|n]? " % (len (zombie_follows )))
22
+ if confirm .lower () == 'y' :
23
+ for id in zombie_follows :
24
+ user = twitter_api .DestroyFriendship (user_id = id )
25
+ print "Unfollowed %s" % (user .screen_name )
Original file line number Diff line number Diff line change 1
1
## Just another repo of Python scripts
2
2
3
3
1 . ** 01_remove_all_pyc.md** : remove all * .pyc* files from a git repo
4
- 2 . ** 02_find_all_links.py** : get all links from a webpage
4
+ 2 . ** 02_find_all_links.py** : get all links from a webpage
5
+ 3 . ** 03_simple_twitter_manager.py** : accessing the Twitter API, example functions
2A78
react-app>
You can’t perform that action at this time.
0 commit comments