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 passing custom headers to NetBox #219

Closed
newlandk opened this issue Jan 23, 2020 · 1 comment
Closed

Allow passing custom headers to NetBox #219

newlandk opened this issue Jan 23, 2020 · 1 comment

Comments

@newlandk
Copy link

I run a NetBox instance behind a proxy service that assists with logging and tracking of requests beyond what NetBox provides natively. It would be useful if we could append custom headers to the request to support injection of custom values as needed.

e.g.

import pynetbox
nb = pynetbox.api(
    'http://localhost:8000',
    token='d6f4e314a5b5fefd164995169f28ae32d987704f',
    custom_headers={'Tracking-Header': 'tracking_header_value'}
)

sample request header

headers = {
    "Content-Type": "application/json;",
    "Tracking-Header": "tracking_header_value"
}
@zachmoody
Copy link
Contributor

You can do this now by passing your own requests.Session() object to Api.http_session, here are the docs.

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

No branches or pull requests

2 participants