pynetbox icon indicating copy to clipboard operation
pynetbox copied to clipboard

extras.scripts.all() is broken

Open ziggekatten opened this issue 6 months ago • 1 comments

pynetbox version

v7.4.1

NetBox version

v3.7.5

Python version

3.12

Steps to Reproduce

import pynetbox
nb = pynetbox.api(
    'https://nebboxhost',
    token='secrettoken'
)

scripts = nb.extras.scripts.all()
for script in scripts:
    print(script.name)

Expected Behavior

A list of scripts

Observed Behavior

I will print out the scripts name, but after listing the last script, the following error occurs:

Traceback (most recent call last):
  File "C:\scappy\netbox_ingest.py", line 8, in <module>
    for script in scripts:
  File "C:\scappy\venv\Lib\site-packages\pynetbox\core\response.py", line 127, in __next__
    next(self.response), self.endpoint.api, self.endpoint
    ^^^^^^^^^^^^^^^^^^^
  File "C:\scappy\venv\Lib\site-packages\pynetbox\core\query.py", line 319, in get
    while req["next"]:
          ~~~^^^^^^^^
KeyError: 'next'

Temporary workaround is to use try/except, but it should be fixed

ziggekatten avatar Apr 12 '25 09:04 ziggekatten