From f16db7aa249985a1dd7fad5a0a58fc26d980dcfb Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Thu, 9 Jun 2016 04:37:32 +0300 Subject: refactoring --- track_status.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/track_status.py b/track_status.py index 129b236..3953428 100644 --- a/track_status.py +++ b/track_status.py @@ -4,7 +4,7 @@ import logging, time -from api import * +import api def format_user(user): if user.has_last_name(): @@ -52,7 +52,7 @@ def print_status_update(user): else: user_went_offline(user) -USER_FIELDS = User.Field.ONLINE, User.Field.LAST_SEEN +USER_FIELDS = api.User.Field.ONLINE, api.User.Field.LAST_SEEN def update_status(api, uids): return {user.get_uid(): user for user in api.users_get(uids, USER_FIELDS)} @@ -67,7 +67,7 @@ def loop_update_status(api, uids, timeout=DEFAULT_TIMEOUT): time.sleep(timeout) try: updated_users = update_status(api, uids) - except API.ConnectionError: + except api.ConnectionError: continue for uid in updated_users: if users[uid].is_online() != updated_users[uid].is_online(): @@ -101,7 +101,7 @@ if __name__ == '__main__': level=logging.INFO, datefmt='%Y-%m-%d %H:%M:%S') - api = API(Language.EN) + api = api.API(api.Language.EN) try: loop_update_status(api, args.uids, timeout=args.timeout) -- cgit v1.2.3