diff options
Diffstat (limited to '')
-rw-r--r-- | mutual_friends.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/mutual_friends.py b/mutual_friends.py index 9de77cb..20bb32a 100644 --- a/mutual_friends.py +++ b/mutual_friends.py @@ -2,8 +2,6 @@ # This file is licensed under the terms of the MIT License. # See LICENSE.txt for details. -import sys - from api import * def query_friends(api, user): @@ -17,15 +15,16 @@ def format_user(user): if __name__ == '__main__': import argparse + parser = argparse.ArgumentParser( description='Learn who your ex and her new boyfriend are both friends with.') - parser.add_argument(metavar='UID', dest='user_ids', nargs='+', + parser.add_argument(metavar='UID', dest='uids', nargs='+', help='user IDs or "screen names"') args = parser.parse_args() api = API(Language.EN) - users = api.users_get(args.user_ids, fields=User.Field.SCREEN_NAME) + users = api.users_get(args.uids, fields=User.Field.SCREEN_NAME) friend_lists = map(lambda user: frozenset(query_friends(api, user)), users) mutual_friends = frozenset.intersection(*friend_lists) |