Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Im see the following error when I run nb-dt-import.py

(venv) user@netbox:~/Device-Type-Library-Import$ ./nb-dt-import.py
Package devicetype-library is already installed, updating /home/user/Device-Type-Library-Import/repo
Traceback (most recent call last):
File "/home/user/Device-Type-Library-Import/./nb-dt-import.py", line 54, in
main()
File "/home/user/Device-Type-Library-Import/./nb-dt-import.py", line 17, in main
netbox = NetBox(settings)
File "/home/user/Device-Type-Library-Import/netbox_api.py", line 28, in init
self.verify_compatibility()
File "/home/user/Device-Type-Library-Import/netbox_api.py", line 50, in verify_compatibility
version_split = [int(x) for x in self.netbox.version.split('.')]
File "/home/user/Device-Type-Library-Import/venv/lib/python3.10/site-packages/pynetbox/core/api.py", line 109, in version
).get_version()
File "/home/user/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 403 Forbidden: {'detail': 'Authentication credentials were not provided.'}

You must be logged in to vote

Replies: 2 comments · 3 replies

Comment options

I am getting this same error, I have tried creating and updating the .env file with new API tokens from the Netbox Gui and it is just refusing to work. If you find an answer to this issue, please share it with me. I will do the same for you!

You must be logged in to vote
0 replies
Comment options

If your filepath is /opt/netbox/netbox/netbox
you should go to configure your configuration.py file. Change this single setting from = False to = True and it worked for me immediately after.

API Cross-Origin Resource Sharing (CORS) settings. If CORS_ORIGIN_ALLOW_ALL is set to True, all origins will be
allowed. Otherwise, define a list of allowed origins using either CORS_ORIGIN_WHITELIST or
CORS_ORIGIN_REGEX_WHITELIST. For more information, see https://github.com/ottoyiu/django-cors-headers
CORS_ORIGIN_ALLOW_ALL = True
CORS_ORIGIN_WHITELIST = [

You must be logged in to vote
3 replies
@VF1JVeritech
Comment options

I tried setting this to True, restarted all netbox services and even rebooted the server. Checked this setting was still set to True and I'm still getting the same error. I have also verified the API key was configured for Write permissions and used both keys generated from the admin console and My API Keys while logged in. Still no luck. Any special formatting required for the .env file?

@VF1JVeritech
Comment options

Found my issue. For full info disclosure, my API key is generated under the users My API Keys section, I am using an internal CA so cert checking is disabled as the import checks public Roots even though our internal root is added to the root ca file, and a default install following the clone and environment setup. The CORS_ORIGIN_ALLOW_ALL - True is set (will be set back to False after import currently running) and forcing the pynetbox version 7.3.4 right after running the requirements.txt installs with this command: pip install --force-reinstall -v "pynetbox==7.3.4"
Once 7.3.4 was installed the import is running with tls warnings of course but it is actively importing the devices and other data from this project. I found this command in the issues section here and wanted to post it here as well.

@alterna-libor
Comment options

Reinstall pynetbox to version 7.3.4 works to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.