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

ability to add extra headers while sending the request #87

Merged
merged 2 commits into from
Jul 24, 2023

Conversation

devqore
Copy link
Contributor

@devqore devqore commented Jul 19, 2023

When I'm trying to access the Jenkins instance which is behind Google Cloud IAP with additional headers as follows:

server = Jenkins("https://jenkins.behind.iap", auth=('xxx', 'yyy'),
                 headers={"Proxy-Authorization": "Bearer zzz"})
job = server.get_job('some-job')

I'm getting the exception:

Traceback (most recent call last):
  File "/xxx/venv/lib/python3.9/site-packages/api4jenkins/item.py", line 71, in handle_req
    return self.jenkins.send_req(method, self.url + entry, **kwargs)
  File "/xxx/venv/lib/python3.9/site-packages/api4jenkins/requester.py", line 27, in send
    resp = session.request(method, url, **kwargs, **kw)
TypeError: requests.sessions.Session.request() got multiple values for keyword argument 'headers'

This pull request solves the problem and additional headers might be added.

@codecov
Copy link

codecov bot commented Jul 21, 2023

Codecov Report

Merging #87 (004ea56) into master (1c70a01) will increase coverage by 0.01%.
The diff coverage is 100.00%.

❗ Current head 004ea56 differs from pull request most recent head 1c217d9. Consider uploading reports for the commit 1c217d9 to get more accurate results

@@            Coverage Diff             @@
##           master      #87      +/-   ##
==========================================
+ Coverage   85.95%   85.97%   +0.01%     
==========================================
  Files          18       18              
  Lines         940      941       +1     
==========================================
+ Hits          808      809       +1     
  Misses        132      132              
Flag Coverage Δ
integration 68.65% <100.00%> (+0.03%) ⬆️
unittest 84.04% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
api4jenkins/requester.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@joelee2012
Copy link
Owner

@devqore are you able to update version and history ?

@devqore
Copy link
Contributor Author

devqore commented Jul 24, 2023

@joelee2012 thanks for checking. The release history was updated, and the version was bumped by one patch number, is this ok?

@joelee2012
Copy link
Owner

@devqore great

@joelee2012 joelee2012 merged commit d7ccaf7 into joelee2012:master Jul 24, 2023
8 checks passed
@joelee2012
Copy link
Owner

new release v1.14.1 has been created

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.

None yet

2 participants