Skip to content

Commit

Permalink
Parse bool correctly (#916)
Browse files Browse the repository at this point in the history
  • Loading branch information
jowlee committed Oct 9, 2020
1 parent 8c6fdbf commit 9870f49
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions discovery-provider/src/api/v1/metrics.py
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
@@ -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

0 comments on commit 9870f49

Please sign in to comment.