Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse bool correctly #916

Merged
merged 1 commit into from
Oct 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions discovery-provider/src/api/v1/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from src.queries.get_genre_metrics import get_genre_metrics
from src.queries.get_plays_metrics import get_plays_metrics
from flask import Flask, Blueprint
from flask_restx import Resource, Namespace, fields, reqparse
from flask_restx import Resource, Namespace, fields, reqparse, inputs
from src.api.v1.helpers import make_response, success_response, to_dict, \
parse_bool_param, parse_unix_epoch_param, abort_bad_request_param
from .models.metrics import route_metric, app_name_metric, app_name, plays_metric, genre_metric
Expand Down Expand Up @@ -90,7 +90,7 @@ def get(self):
metrics_app_name_list_parser.add_argument('start_time', required=False, type=int)
metrics_app_name_list_parser.add_argument('limit', required=False, type=int)
metrics_app_name_list_parser.add_argument('offset', required=False, type=int)
metrics_app_name_list_parser.add_argument('include_unknown', required=False, type=bool)
metrics_app_name_list_parser.add_argument('include_unknown', required=False, type=inputs.boolean)

@ns.route("/app_name", doc=False)
class AppNameListMetrics(Resource):
Expand Down
5 changes: 2 additions & 3 deletions discovery-provider/src/api/v1/tracks.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from urllib.parse import urljoin
import logging # pylint: disable=C0302
from flask import redirect
from flask_restx import Resource, Namespace, fields, reqparse
from flask_restx import Resource, Namespace, fields, reqparse, inputs
from src.queries.get_tracks import get_tracks
from src.queries.get_track_user_creator_node import get_track_user_creator_node
from src.api.v1.helpers import abort_not_found, decode_with_abort, \
Expand Down Expand Up @@ -96,7 +96,7 @@ def get(self, track_id):
full_track_parser = reqparse.RequestParser()
full_track_parser.add_argument('handle')
full_track_parser.add_argument('url_title')
full_track_parser.add_argument('show_unlisted', type=bool)
full_track_parser.add_argument('show_unlisted', type=inputs.boolean)
full_track_parser.add_argument('user_id')

@full_ns.route(TRACK_ROUTE)
Expand All @@ -110,7 +110,6 @@ def get(self, track_id):
current_user_id = args.get("user_id")
if current_user_id:
current_user_id = decode_string_id(current_user_id)

if args.get("show_unlisted"):
url_title, handle = args.get("url_title"), args.get("handle")
if not (url_title and handle):
Expand Down