def _MockGetEvents(start_date, end_date, desc): """ test the web url "/get_events" """ sqlx, sqlx_count = DBAccess.bld_query_sql(start_date, end_date, desc) list_result = DBAccess.get_events(sqlx, sqlx_count) if list_result[0] == 'error': sj = {"events_error": list_result[1]} else: sj = {"events_details": list_result[1]} print sj print "MockGetEvent ended"
def get_events(): """ Get events function, either by dates and or description """ req = request start_date = request.args.get("start_date") end_date = request.args.get("end_date") desc = request.args.get("event_desc") sqlx, sqlx_count = DBAccess.bld_query_sql(start_date, end_date, desc) list_result = DBAccess.get_events(sqlx, sqlx_count) if list_result[0] == 'error': sj = jsonify({"events_error": list_result[1]}) else: sj = jsonify({"events_details": list_result[1]}) return sj