diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-06-15 19:46:36 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-06-15 19:46:36 +0300 |
commit | 08f32d0ea1dfceb466c0d7990944523f1c253d16 (patch) | |
tree | 1bc5b078d2724dd34d2c9f97b9a7f9abc2af04fd /mutual_friends.py | |
parent | api.ConnectionError -> api.APIConnectionError (diff) | |
download | vk-scripts-08f32d0ea1dfceb466c0d7990944523f1c253d16.tar.gz vk-scripts-08f32d0ea1dfceb466c0d7990944523f1c253d16.zip |
move API wrappers to a package
Diffstat (limited to '')
-rw-r--r-- | mutual_friends.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/mutual_friends.py b/mutual_friends.py index 20bb32a..2f32038 100644 --- a/mutual_friends.py +++ b/mutual_friends.py @@ -2,10 +2,11 @@ # This file is licensed under the terms of the MIT License. # See LICENSE.txt for details. -from api import * +import vk.api +import vk.user def query_friends(api, user): - return api.friends_get(user.get_uid(), fields=User.Field.SCREEN_NAME) + return api.friends_get(user.get_uid(), fields=vk.user.Field.SCREEN_NAME) def format_user(user): if user.has_last_name(): @@ -23,8 +24,8 @@ if __name__ == '__main__': help='user IDs or "screen names"') args = parser.parse_args() - api = API(Language.EN) - users = api.users_get(args.uids, fields=User.Field.SCREEN_NAME) + api = vk.api.API(vk.api.Language.EN) + users = api.users_get(args.uids, fields=vk.user.Field.SCREEN_NAME) friend_lists = map(lambda user: frozenset(query_friends(api, user)), users) mutual_friends = frozenset.intersection(*friend_lists) |