diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-06-16 23:32:24 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-06-16 23:32:24 +0300 |
commit | eb930123454771b80465505579d723c92b3dd84c (patch) | |
tree | 9aeded9c85edc2ae9c00ae904d252558731d93f7 /mutual_friends.py | |
parent | make "last seen" timestamps timezone-aware (diff) | |
download | vk-scripts-eb930123454771b80465505579d723c92b3dd84c.tar.gz vk-scripts-eb930123454771b80465505579d723c92b3dd84c.zip |
refactoring & support more user fields
And a bunch of other minor improvements.
Diffstat (limited to 'mutual_friends.py')
-rw-r--r-- | mutual_friends.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/mutual_friends.py b/mutual_friends.py index 7df408a..b0bf363 100644 --- a/mutual_friends.py +++ b/mutual_friends.py @@ -9,12 +9,12 @@ import json import sys import vk.api -from vk.user import Field +from vk.user import UserField -def query_friend_list(api, user): - return api.friends_get(user.get_uid(), fields=Field.SCREEN_NAME) +OUTPUT_FIELDS = UserField.UID, UserField.FIRST_NAME, UserField.LAST_NAME, UserField.SCREEN_NAME -OUTPUT_FIELDS = Field.UID, Field.FIRST_NAME, Field.LAST_NAME, Field.SCREEN_NAME +def query_friend_list(api, user): + return api.friends_get(user.get_uid(), fields=OUTPUT_FIELDS) def extract_output_fields(user): new_user = OrderedDict() @@ -67,7 +67,7 @@ if __name__ == '__main__': args = parser.parse_args() api = vk.api.API(vk.api.Language.EN) - users = api.users_get(args.uids, fields=Field.SCREEN_NAME) + users = api.users_get(args.uids) friend_lists = map(lambda user: frozenset(query_friend_list(api, user)), users) mutual_friends = frozenset.intersection(*friend_lists) |