Closed
Description
Issue Summary
We should implement request logging. SendGrid support will frequent want this information when helping customers debug their application. This information should include what API they are calling, what response code, and what error message we get back.
Possible Solutions
- Natively create a
logging.Logger
object. - Switch to using
urllib3
instead ofurllib
as it has alogging.Logger
which can be configured. - Add an option to be able to pass a custom
urllib.requests.OpenerDirector
or similar. - A workaround I found was setting
http.client.HTTPConnection.debuglevel = 1
but this did not seem to work for me in an AWS lambda environment. (I still need to investigate if there is an issue with my code on this though.)
I welcome feedback and would like to know if the community has any objections to adding dependencies (option 1) or changing dependencies (option 2) as I think these are the simplest methods.
Technical details:
- python-http-client version: 3.2.7
- python version: 3.7.8