Skip to content
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.

Support generic headers and HTTP timeouts #226

Merged
merged 1 commit into from
Jan 20, 2020

Conversation

mcsimps2
Copy link
Contributor

Instead of solely urllib3.utils.make_headers compatible headers, there is now the ability to pass generic headers, such as "Authorization." For example, the following is now valid headers argument when creating a Client:

headers={
    "accept_encoding": "gzip",  # Parsed by urllib3.utils.make_headers to "Accept-Encoding"
    "Authorization": "Bearer " + str(access_token) # Not parsed by urllib3
}

Furthermore, http timeouts are honored in the FileDownloader.

Fixes #218 and implements #219.

@mcsimps2 mcsimps2 force-pushed the add-http-headers branch 3 times, most recently from ede9144 to 040368e Compare December 25, 2019 06:59
@JMSwag
Copy link
Member

JMSwag commented Dec 29, 2019

@mcsimps2 We may have hit nedbat/coveragepy#883

Trying a fix in #228

@JMSwag
Copy link
Member

JMSwag commented Dec 29, 2019

@mcsimps2 Fixed on master. Please rebase.

@codecov
Copy link

codecov bot commented Jan 2, 2020

Codecov Report

Merging #226 into master will increase coverage by 0.13%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #226      +/-   ##
==========================================
+ Coverage   86.72%   86.86%   +0.13%     
==========================================
  Files          23       23              
  Lines        2335     2344       +9     
==========================================
+ Hits         2025     2036      +11     
+ Misses        310      308       -2
Impacted Files Coverage Δ
pyupdater/client/patcher.py 82.58% <100%> (+0.08%) ⬆️
pyupdater/client/downloader.py 88.88% <100%> (+1.44%) ⬆️
pyupdater/client/updates.py 77.68% <100%> (ø) ⬆️
pyupdater/client/__init__.py 88.41% <100%> (-0.05%) ⬇️

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 1abe00d...d0e29f4. Read the comment docs.

Instead of solely urllib3 header support, there is now the ability to pass generic headers such as "Authorization" in addition to the urllib3 headers (e.g. "basic_auth").  Furthermore, http timeouts are honored in the FileDownloader.
@mcsimps2 mcsimps2 marked this pull request as ready for review January 13, 2020 14:00
@mcsimps2
Copy link
Contributor Author

mcsimps2 commented Jan 13, 2020

Okay, the PR is ready for review now, with an added test on the headers - let me know what changes need to be made

@JMSwag
Copy link
Member

JMSwag commented Jan 16, 2020

@mcsimps2 Hey! Sorry for the delayed reply. Please remove the Py2 support.

@JMSwag JMSwag merged commit 8e1cd2b into Digital-Sapphire:master Jan 20, 2020
mcsimps2 added a commit to mcsimps2/PyUpdater that referenced this pull request Jan 20, 2020
The current headers logic uses inspect for argument inspection, and since the behavior differs between Py3 and Py2, the six package was being used.  Since we no longer support Py2, this commit removes the corresponding statements for Digital-Sapphire#226
@mcsimps2
Copy link
Contributor Author

My apologies, I'm a little behind on everything! I've removed support here: #232

@JMSwag
Copy link
Member

JMSwag commented Jan 20, 2020

@mcsimps2 No worries. I appreciate the help!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Honor HTTP_TIMEOUT in FileDownloader
2 participants