Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module has no object Shodan #4

Closed
wandeg opened this issue Mar 12, 2014 · 6 comments
Closed

module has no object Shodan #4

wandeg opened this issue Mar 12, 2014 · 6 comments

Comments

@wandeg
Copy link

wandeg commented Mar 12, 2014

In the implementation of the basic search example, using shodan.Shodan(SHODAN_API_KEY) throws an error.
I think it should be shodan.WebAPI(SHODAN_API_KEY)

@achillean
Copy link
Owner

Please make sure you're running the latest version of the Shodan Python library. The "Shodan" class is the wrapper for the new REST API that is documented at https://developer.shodan.io whereas "WebAPI" is the wrapper for the old/ deprecated API at http://docs.shodanhq.com

The "Shodan" class is implemented in the shodan.client module, and it gets automatically imported to the shodan module so you don't need to do anything extra. I.e. this works with the latest code:

import shodan
api = shodan.Shodan("API KEY")
results = api.search('apache')

If it doesn't work then you're not using the latest version of the library, in which case try to run "easy_install -U shodan".

@GelosSnake
Copy link

Getting same issue using the newest version and following Shodan docs.
AttributeError: 'module' object has no attribute 'Shodan'

@achillean
Copy link
Owner

Make sure the name of your script isn't "shodan", otherwise it will conflict with the library's name.

@GelosSnake
Copy link

Yep that was it, cheers!

@ManivannanMurugavel
Copy link

Please change the file name shodan.py to python_test.py or etc

@christiancoleman
Copy link

christiancoleman commented Jun 10, 2019

@achillean Still helping people nearly 5 years later.

The lesson (and error) being unrelated to shodan specifically now that I consider this more. It's a good thing to remember when naming my python files and using any modules. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants