def main(): config = Config.createConfig() for id in config.ids: api = Api(config.appId, id, token=config.token) config.token = api.token # for future for target in config.targets: target.process(api) return for id in config.ids: api.setId(id) for target, settings in config.targets.items(): if not settings.download: logging.info("{}: do not download.".format(target)) continue if target == 'wall': logging.info('Current target: {}'.format(target)) # determine posts count r = api.wallCount() interact(locals()) logging.info("Total posts: {}".format(count)) logging.info("Wall dowload start") return args.wall_start, args.wall_end, total = ranges(args.wall_start, args.wall_end, count) counter = 0.0 # float for % post_parser = PostParser(args.directory, str(args.id), args) for x in xrange(args.wall_start, args.wall_end): if args.verbose and counter % 10 == 0: logging.info("\nDone: {:.2%} ({})".format(counter / total, int(counter))) (post, json_stuff) = call_api("wall.get", [("owner_id", args.id), ("count", 1), ("offset", x)], args) process_post(("wall post", x), post, post_parser, json_stuff) counter += 1 if args.verbose: logging.info("\nDone: {:.2%} ({})".format(float(total) / total, int(total))) continue elif target == 'audio': raise NotImplementedError elif target == 'friends': raise NotImplementedError elif target == 'notes': raise NotImplementedError elif target == 'video': raise NotImplementedError elif target == 'docs': raise NotImplementedError else: continue logging.info("End") return '''