Skip to content

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 Nov 20, 2024
@codecov
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

1 participant