# check the page size is an integer try: psize = int(psize) except: raise Api400Error("Page size was not an integer") try: results = DiscoveryApi.search('application', current_user, search_query, page, psize, sort) except DiscoveryException as e: raise Api400Error(e.message) return jsonify_models(results) @swag(swag_summary='Search journals', swag_spec=DiscoveryApi.get_journal_swag()) # must be applied after @api_key_(optional|required) decorators. They don't preserve func attributes. @blueprint.route('/search/journals/<path:search_query>') def search_journals(search_query): # get the values for the 2 other bits of search info: the page number and the page size page = request.values.get("page", 1) psize = request.values.get("pageSize", 10) sort = request.values.get("sort") # check the page is an integer try: page = int(page) except: raise Api400Error("Page number was not an integer") # check the page size is an integer try:
# check the page size is an integer try: psize = int(psize) except: raise Api400Error("Page size was not an integer") try: results = DiscoveryApi.search('application', current_user, search_query, page, psize, sort) except DiscoveryException as e: raise Api400Error(str(e)) return jsonify_models(results) @swag(swag_summary='Search journals', swag_spec=DiscoveryApi.get_journal_swag()) # must be applied after @api_key_(optional|required) decorators. They don't preserve func attributes. @blueprint.route('/search/journals/<path:search_query>') @analytics.sends_ga_event(GA_CATEGORY, GA_ACTIONS.get('search_journals', 'Search journals'), record_value_of_which_arg='search_query') def search_journals(search_query): # get the values for the 2 other bits of search info: the page number and the page size page = request.values.get("page", 1) psize = request.values.get("pageSize", 10) sort = request.values.get("sort") # check the page is an integer try: page = int(page) except: raise Api400Error("Page number was not an integer") # check the page size is an integer
try: psize = int(psize) except: raise Api400Error("Page size was not an integer") try: results = DiscoveryApi.search('application', current_user, search_query, page, psize, sort) except DiscoveryException as e: raise Api400Error(e.message) return jsonify_models(results) @swag( swag_summary='Search journals', swag_spec=DiscoveryApi.get_journal_swag() ) # must be applied after @api_key_(optional|required) decorators. They don't preserve func attributes. @blueprint.route('/search/journals/<path:search_query>') def search_journals(search_query): # get the values for the 2 other bits of search info: the page number and the page size page = request.values.get("page", 1) psize = request.values.get("pageSize", 10) sort = request.values.get("sort") # check the page is an integer try: page = int(page) except: raise Api400Error("Page number was not an integer") # check the page size is an integer