From 01f0af3e4f160d57523166208bd15acc2b135d90 Mon Sep 17 00:00:00 2001 From: db0 Date: Tue, 12 Sep 2023 01:26:25 +0200 Subject: [PATCH] fix: made page a query --- fediseer/apis/v1/__init__.py | 2 +- fediseer/apis/v1/report.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fediseer/apis/v1/__init__.py b/fediseer/apis/v1/__init__.py index a76f3ca..18e554b 100644 --- a/fediseer/apis/v1/__init__.py +++ b/fediseer/apis/v1/__init__.py @@ -23,4 +23,4 @@ api.add_resource(guarantees.Guarantors, "/guarantors/") api.add_resource(guarantees.Guarantees, "/guarantees/") api.add_resource(badges.GuaranteeBadge, "/badges/guarantees/.svg") api.add_resource(badges.EndorsementBadge, "/badges/endorsements/.svg") -api.add_resource(report.Report, "/reports/") +api.add_resource(report.Report, "/reports") diff --git a/fediseer/apis/v1/report.py b/fediseer/apis/v1/report.py index 8c48f73..92d5f45 100644 --- a/fediseer/apis/v1/report.py +++ b/fediseer/apis/v1/report.py @@ -9,11 +9,12 @@ class Report(Resource): get_parser.add_argument("target_domains_csv", required=False, default=None, type=str, help="A csv of target domains for which to filter", location="args") get_parser.add_argument("report_type", required=False, default=None, type=str, help=f"The activity of report to filer {[e.name for e in enums.ReportType]}", location="args") get_parser.add_argument("report_activity", required=False, default=None, type=str, help=f"The activity of report to filer {[e.name for e in enums.ReportActivity]}", location="args") + get_parser.add_argument("page", required=False, default=1, type=int, help=f"The page of reports to display.", location="args") @api.expect(get_parser) @api.marshal_with(models.response_model_reports, code=200, description='Report', as_list=True) @api.response(400, 'Validation Error', models.response_model_error) - def get(self,page=1): + def get(self): '''Retrieve instance information via API Key at 10 results per page ''' self.args = self.get_parser.parse_args() @@ -40,7 +41,7 @@ class Report(Resource): target_instances = target_domains, report_type=report_type, report_activity=report_activity, - page=page, + page=self.args.page, ) report_response = [] for r in reports: