Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Complete Guide to Shodan
#1
I am going through this Book "Complete Guide to Shodan" and there is this code but it doesn't work

import shodan
api = shodan.Shodan('myapikeyhere')

# Wrap the request in a try/ except block to catch errors
try:
    results = api.search('apache')
    print('Results found: %s' % results['total'])
    for result in results['matches']:
        print('IP: %s' % result['ip_str'])
        print(result['data'])
        print('')
except shodan.APIError, e:
    print('Error: %s' % e)
The error I am getting

 except shodan.APIError, e:
           ^^^^^^^^^^^^^^^^^^
SyntaxError: multiple exception types must be parenthesized
Reply


Messages In This Thread
Complete Guide to Shodan - by Calli - Jul-16-2022, 04:32 PM
RE: Complete Guide to Shodan - by snippsat - Jul-16-2022, 06:34 PM
RE: Complete Guide to Shodan - by Calli - Jul-16-2022, 07:08 PM
RE: Complete Guide to Shodan - by snippsat - Jul-16-2022, 07:35 PM
RE: Complete Guide to Shodan - by Calli - Jul-18-2022, 04:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  New User online Guide NAP1947 1 1,588 Sep-06-2020, 04:36 PM
Last Post: Larz60+
  Not able to crack a simple visualization – missing something basic – plz guide darpInd 4 2,874 Mar-27-2020, 09:26 AM
Last Post: darpInd
  "Up to but not including" (My personal guide on slicing & indexing) Drone4four 5 3,030 Nov-20-2019, 09:38 PM
Last Post: newbieAuggie2019
  Looking for a Guide Through the Labyrinth stephenmolnar 1 2,132 Jan-23-2019, 08:22 PM
Last Post: Larz60+
  [split] Python Guide / Document? kumatul 2 2,775 Jan-16-2019, 12:49 AM
Last Post: micseydel
  Python Guide / Document? Qui_Ten 1 2,862 Jan-13-2019, 07:50 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020