def __init__(self, config_file="config.json"): logger.info('Initialising...') try: config = config_loader.config_setup(config_file) self.client = soundcloud.Client( client_id=config['CLIENT_ID'], client_secret=config['CLIENT_SECRET'], username=config['USERNAME'], password=config['PASSWORD'] ) except Exception, e: logger.fatal('Failed to load configuration: %s', e) raise e
args = parser.parse_args() config_file = args.account_name + ".json" log_file = args.account_name + ".log" number = int(args.number_to_follow) unfollow_non = args.unfollow_non unfollow_all = args.unfollow_all info = args.info reset = args.reset dnu = args.dnu unfollow = args.unfollow_all lookup = args.lookupusername groups = args.groups lookupid = args.lookupid config = config_loader.config_setup(config_file) followers_filename = config['FOLLOWERS_FILE'] following_filename = config['FOLLOWING_FILE'] dnf_filename = config['DO_NOT_FOLLOW_FILE'] dnu_filename = config['DO_NOT_UNFOLLOW_FILE'] groups_file = config['GROUPS_FILE'] script_path = os.path.dirname(os.path.realpath(__file__)) + '/' logging.basicConfig(format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', filename=script_path + log_file, level=logging.INFO) logging.getLogger("requests").setLevel(logging.WARNING) logging.getLogger("urllib3").setLevel(logging.WARNING) logging.getLogger("config_loader").setLevel(logging.WARNING) logger = logging.getLogger(name='soundcloud-follower')