netbox-community / Device-Type-Library-Import

This library is intended to assist with importing device and module types into NetBox from the NetBox Community DeviceType-Library
https://github.com/netbox-community/devicetype-library
MIT License
246 stars 74 forks source link

The request failed with code 400 Bad Request #113

Closed dietybright closed 9 months ago

dietybright commented 9 months ago

When trying to run import script I am having below issue, any idea?

root@netbox:/opt/netbox/Netbox-Device-Type-Library-Import# source venv/bin/activate (venv) root@netbox:/opt/netbox/Netbox-Device-Type-Library-Import# cat .env

NETBOX_URL=https://localhost NETBOX_TOKEN=5baac1bba5e79bb222779d6b9a524e2ce09d6e93 REPO_URL=https://github.com/netbox-community/devicetype-library.git REPO_BRANCH=master IGNORE_SSL_ERRORS=True

SLUGS=c9300-48u isr4431 isr4331

(venv) root@netbox:/opt/netbox/Netbox-Device-Type-Library-Import# ./nb-dt-import.py --vendors cisco

Package devicetype-library is already installed, updating /opt/netbox/Netbox-Device-Type-Library-Import/repo /opt/netbox/Netbox-Device-Type-Library-Import/venv/lib/python3.10/site-packages/urllib3/connectionpool.py:1095: InsecureRequestWarning: Unverified HTTPS request is being made to host 'localhost'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings warnings.warn( Traceback (most recent call last): File "/opt/netbox/Netbox-Device-Type-Library-Import/./nb-dt-import.py", line 54, in main() File "/opt/netbox/Netbox-Device-Type-Library-Import/./nb-dt-import.py", line 17, in main netbox = NetBox(settings) File "/opt/netbox/Netbox-Device-Type-Library-Import/netbox_api.py", line 28, in init self.verify_compatibility() File "/opt/netbox/Netbox-Device-Type-Library-Import/netbox_api.py", line 50, in verify_compatibility version_split = [int(x) for x in self.netbox.version.split('.')] File "/opt/netbox/Netbox-Device-Type-Library-Import/venv/lib/python3.10/site-packages/pynetbox/core/api.py", line 109, in version ).get_version() File "/opt/netbox/Netbox-Device-Type-Library-Import/venv/lib/python3.10/site-packages/pynetbox/core/query.py", line 187, in get_version raise RequestError(req) pynetbox.core.query.RequestError: The request failed with code 400 Bad Request but more specific details were not returned in json. Check the NetBox Logs or investigate this exception's error attribute.

dietybright commented 9 months ago

The issue is fixed now, change NETBOX_URL=https://localhost/ to actually IP address

danner26 commented 9 months ago

I am glad you were able to figure it out! If you need anything else feel free to reach out