[CentOS-devel] [PATCH] Update API path in centos.git.repolist.py

Laurentiu Pancescu

lpancescu at gmail.com
Mon Jun 26 21:07:24 UTC 2017


Hi Brian,

On 26/06/17 15:29, Brian Stinson wrote:
> This looks workable to me, happy to see this merged. Just curious
> though, any reason to not call req.raise_for_status() in the try block
> (after L46) instead of checking the exit code directly?

Not that it matters, but I would have also gone for using 
req.raise_for_status() because:

- it simplifies the error handling code and makes the entire script more 
readable
- it centralizes what we do when something goes wrong, whether socket, 
SSL cert or HTTP errors
- it would display a clearer error message including the HTTP error code 
(which the current code doesn't)

As a minor nitpick, requests.get(url) returns a requests.Response 
object, so I'd probably store it in a variable called "resp", not "req".

Best regards,
Laurențiu



More information about the CentOS-devel mailing list