Replies: 1 comment 3 replies
-
Remove the extra ' |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello guys,
I got some error when I connect to nebox using python,
I tried to fix it but no luck
could you give me some advice?
API_TOKEN = "xxxxx"
HEADERS = {'Authorization': f'Token {API_TOKEN}',
'Content-Type': 'application/json', 'Accept': 'application/json'}
NB_URL = "'https://netbox.xxxx.com"
device_name = "ARISTA-7050SX-64"
requests_url = f"{NB_URL}/api/dcim/interfaces/?device={device_name}"
interfaces_parameters = {
"device" : 322,
"name" : "test",
"description" : "Ethernet0/51",
"type" : "virtual",
"enable" : True,
"mode" : "access"
}
requests.post(requests_url, headers = HEADERS, json=interfaces_parameters)
Error messages
requests.exceptions.InvalidSchema: No connection adapters were found for "'https://netbox.xxxx.com/api/dcim/interfaces/?device=ARISTA-7050SX-64"
I changed the token and site name little. I think because of https certificate.
when I am using pynetbox, I could connect it without issue.
How do i have to change my code? I read a netbox doc official but didn't mention about certificate.
Thank in advance
Beta Was this translation helpful? Give feedback.
All reactions