Compare commits
2 Commits
713015adec
...
dd93b848d1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd93b848d1 | ||
|
|
b3382bc539 |
@ -25,15 +25,22 @@ MRE_request_parser.add_argument('down_payment',
|
||||
|
||||
@namespace.route('/compute_mre')
|
||||
@namespace.doc(params={
|
||||
'consumer_fico': 'The consumer\'s fico score (int).',
|
||||
'home_price': 'The price of the home (float).',
|
||||
'down_payment': 'The down_payment percentage (float).'
|
||||
'consumer_fico': 'The consumer\'s fico score (int) range: [620, 850].',
|
||||
'home_price': 'The price of the home (float) range: [0, inf).',
|
||||
'down_payment': 'The down_payment percentage (float) range: [0-1].'
|
||||
})
|
||||
class ComputeMRE(Resource):
|
||||
@namespace.doc(description='Computes and returns the MRE.')
|
||||
@namespace.expect(MRE_request_parser)
|
||||
@namespace.doc(description='Computes and returns the MRE.',
|
||||
responses={
|
||||
200: 'Good',
|
||||
400: 'Validation Error'
|
||||
})
|
||||
def get(self):
|
||||
args = MRE_request_parser.parse_args()
|
||||
mre = compute_mre(args.home_price, args.down_payment, args.consumer_fico)
|
||||
|
||||
return {'consumer_mre': mre}
|
||||
try:
|
||||
mre = compute_mre(args.home_price, args.down_payment, args.consumer_fico)
|
||||
return {'consumer_mre': mre}
|
||||
except ValueError as ve:
|
||||
return {'error': str(ve)}, 400
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user