-
Issue with
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi everyone, I've figured out why the The issue stems from the fact that we're using an OIDC (OpenID Connect) proxy for authentication when connecting to NetBox. In our Apache configuration, we have the following setup: <Location /api>
<If "-z req('authorization')">
Require valid-user
</If>
<Else>
Require ip <IP_ADDRESS_RANGE>
</Else>
</Location> This configuration requires authorization for accessing the NetBox API. If the request doesn't include an authorization token, the proxy redirects the user to the login page of the OIDC provider. As a result, when the To solve this, we need to ensure that the token is passed to the @property
def version(self):
"""Gets the API version of NetBox.
Can be used to check the NetBox API version if there are
version-dependent features or syntaxes in the API.
:Returns: Version number as a string.
:Example:
>>> import pynetbox
>>> nb = pynetbox.api(
... 'http://localhost:8000',
... token='your_token_here'
... )
>>> nb.version
'3.1'
>>>
"""
version = Request(
base=self.base_url,
token=self.token, # Ensure the token is passed here
http_session=self.http_session,
).get_version()
return version With this change, the Thanks for your input, and I hope this helps anyone else encountering a similar issue! |
Beta Was this translation helpful? Give feedback.
-
Converted to issue #640 |
Beta Was this translation helpful? Give feedback.
Hi everyone,
I've figured out why the
nb.version
property was consistently returning an empty string.The issue stems from the fact that we're using an OIDC (OpenID Connect) proxy for authentication when connecting to NetBox. In our Apache configuration, we have the following setup:
This configuration requires authorization for accessing the NetBox API. If the request doesn't include an authorization token, the proxy redirects the user to the login page of the OIDC provider. As a result, when the
get_version
method inpynetbox
tries …