def get_accounts():
system_id = request.args.get('system_id')
if not system_id:
log.error("Request from {} is missing system_id".format(request.remote_addr))
abort(400)
count = int(request.args.get('count', 1))
min_level = int(request.args.get('min_level', 1))
max_level = int(request.args.get('max_level', 40))
reuse = parse_bool(request.args.get('reuse')) or parse_bool(request.args.get('include_already_assigned'))
banned_or_new = parse_bool(request.args.get('banned_or_new'))
# lat = request.args.get('latitude')
# lat = float(lat) if lat else lat
# lng = request.args.get('longitude')
# lng = float(lng) if lng else lng
log.info(
"System ID [{}] requested {} accounts level {}-{} from {}".format(system_id, count, min_level, max_level,
request.remote_addr))
accounts = Account.get_accounts(system_id, count, min_level, max_level, reuse, banned_or_new)
if len(accounts) < count:
log.warning("Could only deliver {} accounts.".format(len(accounts)))
return jsonify(accounts[0] if accounts and count == 1 else accounts)
评论列表
文章目录