Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@use_args(api_args)
def apidog(args):
sleep(2)
return handle_request("dognzb", args)
@use_args(dict(search_room_args, **{
'limit': fields.Int(missing=None),
'additional_room_ids': fields.List(fields.Int())
}))
def _process(self, args):
query = search_for_rooms(args, only_available=True)
if 'limit' in args:
query = query.limit(args.pop('limit'))
rooms = query.all()
if 'additional_room_ids' in args:
rooms.extend(Room.query.filter(Room.is_active, Room.id.in_(args.pop('additional_room_ids'))))
date_range, availability = get_rooms_availability(rooms, args['start_dt'], args['end_dt'],
args['repeat_frequency'], args['repeat_interval'],
flexibility=0)
date_range = [dt.isoformat() for dt in date_range]
@use_args(user_create_json)
def post(self, args):
if User.query.filter_by(username=args['user']['username']).first():
abort(400, status='error', code=400, message=USER_NAME_EXISTS)
if User.query.filter_by(email=args['user']['email']).first():
abort(400, status='error', code=400, message=USER_EMAIL_EXISTS)
user = User(
username=args['user']['username'],
email=args['user']['email'],
password=args['user']['password']
)
db.session.add(user)
db.session.commit()
s = get_serializer()
payload = s.dumps(args['user']['email'])
_send_verification_email(args['user']['email'], payload)
@use_args(internalapi__getChangelog_args)
def internalapi_getchangelog(args):
_, current_version_readable = get_current_version()
changelog = getChangelog(args["currentVersion"], args["repVersion"])
return jsonify({"changelog": changelog})
@use_args(imdb_data_json)
def post(self, args, movie_id):
movie = Movie.query.get_or_abort(
movie_id, error_msg=MOVIE_NOT_FOUND.format(movie_id)
)
if movie.imdb_data:
abort(
400, status='error', code=400,
message='IMDB data for movie {} already exists'
.format(movie_id)
)
imdb_id = args['imdb_data']['id']
# TODO: Handle inexistent IMDB id
# TODO: Handle already existing IMDB record
@use_args(ping_args)
def ping(args):
now = float(time.time())
if not args["min"]: args["min"] = now - 3600
if not args["max"]: args["max"] = now
data = []
meta = {}
if args["unique"]:
resultset = db.session.query(
Stream.mac, Stream.manuf,
func.min(Stream.arrival).label('min_arrival'),
func.max(Stream.arrival).label('max_arrival'),
func.avg(Stream.signal).label('avg_signal'),\
func.count(Stream.data_id).label('count'))\
.filter(Stream.arrival > args["min"])\
.filter(Stream.arrival <= args["max"])\
.filter(Stream.signal != None)\
@use_args(api_args)
def internal_api(args):
from api import process_for_internal_api
results = None
if args["t"] == "search":
results = search.search(args["q"], args["cat"])
if args["t"] == "tvsearch":
results = search.search_show(args["rid"], args["season"], args["ep"], args["cat"])
if results is not None:
results = process_for_internal_api(results)
return jsonify(results)
return "hello internal api"
@use_args({
'id': fields.Str(required=True),
'username': fields.Str(required=True),
'token': fields.Str(required=True),
})
def blockstack_auth(args):
# Assert that they generated a valid token
if not validate_blockstack_auth(args.get('id'), args.get('username'), args.get('token')):
raise RequestError(code=400, message='Invalid Blockstack token provided')
# Find or create a new user and add the connection
user = Connection.get_user_by_connection(
site='blockstack',
site_id=args.get('id'),
)
if not user:
user = get_authed_user()
@use_args(search_args)
def index(self, args):
return auth_datastore.find_roles(**args), args
@use_args(dict(
query = Str(missing=None),
size = Int(missing=200),
page = Int(missing=1),
corpus = List(Str(), missing=None),
field_id = List(Int(), missing=None),
subfield_id = List(Int(), missing=None),
institution_id = List(Int(), missing=None),
state = List(Str(), missing=None),
country = List(Str(), missing=None),
))
def api_ranks(args):
"""