get limits

pull/32/head
kthouky 2023-09-22 09:54:52 +02:00
parent b33937ae65
commit 735813983f
4 changed files with 10 additions and 3 deletions

View File

@ -13,6 +13,7 @@ class CensuresGiven(Resource):
get_parser.add_argument("min_censures", required=False, default=1, type=int, help="Limit to this amount of censures of more", location="args")
get_parser.add_argument("reasons_csv", required=False, type=str, help="Only retrieve censures where their reasons include any of the text in this csv", location="args")
decorators = [limiter.limit("30/minute"), limiter.limit("5/minute", key_func = get_request_path)]
@api.expect(get_parser)
@cache.cached(timeout=10, query_string=True)
@api.marshal_with(models.response_model_model_Censures_get, code=200, description='Instances', skip_none=True)
@ -151,7 +152,7 @@ class Censures(Resource):
return {"domains": [instance["domain"] for instance in instance_details]},200
return {"instances": instance_details},200
decorators = [limiter.limit("20/minute", key_func = get_request_path)]
decorators = [limiter.limit("30/minute"), limiter.limit("5/minute", key_func = get_request_path)]
put_parser = reqparse.RequestParser()
put_parser.add_argument("apikey", type=str, required=True, help="The sending instance's API key.", location='headers')
put_parser.add_argument("Client-Agent", default="unknown:0:unknown", type=str, required=False, help="The client name and version.", location="headers")
@ -321,4 +322,4 @@ class Censures(Resource):
db.session.add(new_report)
db.session.commit()
logger.info(f"{instance.domain} Withdrew censure from {domain}")
return {"message":'Changed'}, 200
return {"message":'Changed'}, 200

View File

@ -13,6 +13,7 @@ class Approvals(Resource):
get_parser.add_argument("min_endorsements", required=False, default=1, type=int, help="Limit to this amount of endorsements of more", location="args")
get_parser.add_argument("reasons_csv", required=False, type=str, help="Only retrieve endorsements where their reasons include any of the text in this csv", location="args")
decorators = [limiter.limit("30/minute"), limiter.limit("5/minute", key_func = get_request_path)]
@api.expect(get_parser)
@cache.cached(timeout=10, query_string=True)
@api.marshal_with(models.response_model_model_Endorsed_get, code=200, description='Instances', skip_none=True)
@ -86,6 +87,7 @@ class Endorsements(Resource):
get_parser.add_argument("csv", required=False, type=bool, help="Set to true to return just the domains as a csv. Mutually exclusive with domains", location="args")
get_parser.add_argument("domains", required=False, type=bool, help="Set to true to return just the domains as a list. Mutually exclusive with csv", location="args")
decorators = [limiter.limit("30/minute"), limiter.limit("5/minute", key_func = get_request_path)]
@api.expect(get_parser)
@cache.cached(timeout=10, query_string=True)
@api.marshal_with(models.response_model_model_Endorsed_get, code=200, description='Instances', skip_none=True)

View File

@ -9,6 +9,7 @@ class Guarantors(Resource):
get_parser.add_argument("csv", required=False, type=bool, help="Set to true to return just the domains as a csv. Mutually exclusive with domains", location="args")
get_parser.add_argument("domains", required=False, type=bool, help="Set to true to return just the domains as a list. Mutually exclusive with csv", location="args")
decorators = [limiter.limit("30/minute"), limiter.limit("5/minute", key_func = get_request_path)]
@api.expect(get_parser)
@cache.cached(timeout=10, query_string=True)
@api.marshal_with(models.response_model_model_Whitelist_get, code=200, description='Instances', skip_none=True)
@ -35,6 +36,7 @@ class Guarantees(Resource):
get_parser.add_argument("csv", required=False, type=bool, help="Set to true to return just the domains as a csv. Mutually exclusive with domains", location="args")
get_parser.add_argument("domains", required=False, type=bool, help="Set to true to return just the domains as a list. Mutually exclusive with csv", location="args")
decorators = [limiter.limit("30/minute"), limiter.limit("5/minute", key_func = get_request_path)]
@api.expect(get_parser)
@cache.cached(timeout=10, query_string=True)
@api.marshal_with(models.response_model_model_Whitelist_get, code=200, description='Instances', skip_none=True)

View File

@ -13,6 +13,7 @@ class HesitationsGiven(Resource):
get_parser.add_argument("min_hesitations", required=False, default=1, type=int, help="Limit to this amount of hesitations of more", location="args")
get_parser.add_argument("reasons_csv", required=False, type=str, help="Only retrieve hesitations where their reasons include any of the text in this csv", location="args")
decorators = [limiter.limit("30/minute"), limiter.limit("5/minute", key_func = get_request_path)]
@api.expect(get_parser)
@cache.cached(timeout=10, query_string=True)
@api.marshal_with(models.response_model_model_Hesitations_get, code=200, description='Instances', skip_none=True)
@ -91,6 +92,7 @@ class Hesitations(Resource):
get_parser.add_argument("csv", required=False, type=bool, help="Set to true to return just the domains as a csv. Mutually exclusive with domains", location="args")
get_parser.add_argument("domains", required=False, type=bool, help="Set to true to return just the domains as a list. Mutually exclusive with csv", location="args")
decorators = [limiter.limit("30/minute"), limiter.limit("5/minute", key_func = get_request_path)]
@api.expect(get_parser)
@cache.cached(timeout=10, query_string=True)
@api.marshal_with(models.response_model_model_Hesitations_get, code=200, description='Instances', skip_none=True)
@ -306,4 +308,4 @@ class Hesitations(Resource):
db.session.add(new_report)
db.session.commit()
logger.info(f"{instance.domain} Withdrew hesitation from {domain}")
return {"message":'Changed'}, 200
return {"message":'Changed'}, 200