tenable / pyTenable

Python Library for interfacing into Tenable's platform APIs
https://pytenable.readthedocs.io
MIT License
354 stars 173 forks source link

Unable to import ExportsIterator #482

Closed gzdyldz closed 2 years ago

gzdyldz commented 2 years ago

Describe the bug Hi,

I am trying to run a script and It cannot import ExportsIterator. I even tried with a basic script. To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Call '....'
  3. Do '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

System Information (please complete the following information):

Additional context Add any other context about the problem here.

SteveMcGrath commented 2 years ago

can you elaborate as to the issue? running an export seems to work just fine:

>>> from tenable.io import TenableIO
>>> tio = TenableIO()
>>> for v in tio.exports.vulns():
...     print(f'{v["asset"]["uuid"]}: {v["plugin"]["id"]}')
...
ed86b2b9-6a0f-40e8-a27c-25ef46c7a6e7: 34252
ed86b2b9-6a0f-40e8-a27c-25ef46c7a6e7: 34220
ed86b2b9-6a0f-40e8-a27c-25ef46c7a6e7: 34220
ed86b2b9-6a0f-40e8-a27c-25ef46c7a6e7: 34220
ed86b2b9-6a0f-40e8-a27c-25ef46c7a6e7: 34252
ed86b2b9-6a0f-40e8-a27c-25ef46c7a6e7: 34220
ed86b2b9-6a0f-40e8-a27c-25ef46c7a6e7: 34220
42e1623d-b974-44f3-a926-3ed1fbe4fbd9: 34220
42e1623d-b974-44f3-a926-3ed1fbe4fbd9: 34220
... snip ...

The pathway to get to the exportiterator itself has changed in 1.4, however you shouldn't generally need to import it directly.

https://github.com/tenable/pyTenable/blob/master/tenable/io/exports/iterator.py

1.3.x and earlier was:

from tenable.io.exports import ExportsIterator

1.4.x and later use:

from tenable.io.exports.iterator import ExportsIterator
aparekh-justworks commented 2 years ago

Get the same error when I run tenable-jira cli (It was working fine 2 days ago) -

Traceback (most recent call last):
  File "~/.pyenv/versions/3.9.7/bin/tenable-jira", line 5, in <module>
    from tenable_jira.cli import cli
  File "~/.pyenv/versions/3.9.7/lib/python3.9/site-packages/tenable_jira/cli.py", line 31, in <module>
    from .transform import Tio2Jira
  File "~/.pyenv/versions/3.9.7/lib/python3.9/site-packages/tenable_jira/transform.py", line 9, in <module>
    from tenable.io.exports import ExportsIterator
ImportError: cannot import name 'ExportsIterator' from 'tenable.io.exports' (~/.pyenv/versions/3.9.7/lib/python3.9/site-packages/tenable/io/exports/__init__.py