evalai-cli
evalai-cli copied to clipboard
[refactor] Replace conditional ladder in requests utils
As a Google Code-In task.
Changes proposed:
Replace conditional ladder in requests utils, with a single requests.request call.
@vkartik97 @RishabhJain2018 Shall I explicitly remove support for PUT, PATCH, DELETE requests? I realized in the last comment that it accepts all methods and that could give unexpected results.
I realized in the last comment that it accepts all methods and that could give unexpected results.
Can you please provide detailed information regarding this?
@vkartik97 @Ram81 I have generalized the handling message for all errors. The behavior of the function is the same. Please review.
@Ram81 @vkartik97 I have changed the handling mechanism a bit, but the behavior of the function is the same, and with the suggested additions.
- Replace the conditional ladder using a single
requests.requestcall. - Generalize all exceptions caused by
requestsinto a single block. - Use same template for all error messages. This will help keep it consistent.
- Shorten the code (78 lines ->23 lines)
- Remove multiple
exceptblocks.
The efficiency and readability of the code has increased. Please review.
@Ram81 Can I get an approval on the GCI page?