Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow httphandler to have auth and other mediatype #811

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

NickSchouten
Copy link
Contributor

HTTPHandler can now be given auth headers and a different accept media type than application/json

I wanted to use papermill to directly read my git repo (azure devops). Since the repo is not publicly available I needed a way to pass auth to papermill while not breaking any current implementations.

In line with other setups in papermill I added an env variable PAPERMILL_HTTP_AUTH_HEADER that will be passed to requests like this {"headers" {"Authorization": PAPERMILL_HTTP_AUTH_HEADER}}. As such it should work for most auth setups. I only tested it for my use case (base64 encoded basic token).

I then also needed the reply to be "plain/text" instead of "application/json" so also added that option via an env var. PAPERMILL_HTTP_ACCEPT_HEADER

All relevant code is in iorw.py.

Wrote tests for all

@NickSchouten NickSchouten changed the title WIP: Allow httphandler to have auth and other mediatype Allow httphandler to have auth and other mediatype Nov 20, 2024
Copy link

codecov bot commented Nov 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.35%. Comparing base (cb2eb37) to head (630b373).
Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #811      +/-   ##
==========================================
- Coverage   91.54%   91.35%   -0.20%     
==========================================
  Files          17       17              
  Lines        1621     1643      +22     
==========================================
+ Hits         1484     1501      +17     
- Misses        137      142       +5     
---- 🚨 Try these New Features:

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

Successfully merging this pull request may close these issues.

1 participant