Replies: 2 comments 1 reply
-
By providing the correct Authorization header. It needs to be Documentation link: https://docs.netbox.dev/en/stable/integrations/rest-api/#authenticating-to-the-api |
Beta Was this translation helpful? Give feedback.
1 reply
-
Done |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,everyone
My NetBox version is 3.6.0, my pythono version is 3.9.5.
I tried to interact with NetBox through the API, first I got a token through the WEB interface, then i use python's requests package to carry the token to get devices information. But i could not get the right response, python returned me 403 fault: 'Authentication credentials were not provided'. How can I solve this problem?
Below is my python code:
import requests
import urilib3
import json
headers = {"Content-type": "application/json',
"Authorization": "8a071946e39caad4ca323fe26d9dcfaa2aeef9aa'} # token from WEB interface
res = requests.get(url, verify=False, headers=headers)
json_data = json.loads(res.text)
print(res.status_code)
print(json_data)
Beta Was this translation helpful? Give feedback.
All reactions