Skip to content

feat: Use requests Library to Enable Request Logging - #142

Closed
LaikaN57 wants to merge 6 commits into
sendgrid:mainfrom
LaikaN57:feat-req-log
Closed

LaikaN57 wants to merge 6 commits into
sendgrid:mainfrom
LaikaN57:feat-req-log

Conversation

@LaikaN57

@LaikaN57 LaikaN57 commented Jul 28, 2020 •

Copy link
Copy Markdown

Fixes #141

This PR switches out the underlying HTTP library. Instead of using urllib (and related) which uses http under the hood and does not have configuration options for logging requests, we switch to using the requests library which uses urllib3 under the hood and has a module level logger that we can modify to enable request logging.

Checklist

  • I acknowledge that all my contributions will be made under the project's license
  • I have made a material change to the repo (functionality, testing, spelling, grammar)
  • I have read the Contribution Guidelines and my PR follows them
  • I have titled the PR appropriately
  • I have updated my branch with the master branch
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation about the functionality in the appropriate .md file
  • I have added inline documentation to the code I modified

@thinkingserious thinkingserious added the status: code review request requesting a community code review or review from Twilio label Jul 28, 2020
@codecov

codecov Bot commented Jul 28, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #142 into main will decrease coverage by 0.14%.
The diff coverage is 93.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #142      +/-   ##
==========================================
- Coverage   92.73%   92.59%   -0.15%     
==========================================
  Files           6        6              
  Lines         303      297       -6     
==========================================
- Hits          281      275       -6     
  Misses         22       22              
Impacted Files Coverage Δ
python_http_client/client.py 81.25% <87.50%> (-0.20%) ⬇️
tests/test_unit.py 99.24% <100.00%> (-0.03%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1c09a8a...d1374d4. Read the comment docs.

@LaikaN57

Copy link
Copy Markdown
Author

I am no longer convinced that this was a good idea as it looks like requests uses urllib3 which just uses http. And my original assumption that urllib3 provided header logging was incorrect.

I would instead urge readers to just use this until we can get proper logging in the http: https://stackoverflow.com/a/58769712/11015364

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: code review request requesting a community code review or review from Twilio

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Implement Request Logging Options

2 participants