You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm encountering an error with the shodan-python library. My code worked yesterday but is now failing, despite no changes being made.
Here is a test code that produces the same error.
import shodan
import json
# Replace with your Shodan API key
SHODAN_API_KEY = 'KEY_HERE'
def search_shodan():
try:
# Initialize the Shodan API client
api = shodan.Shodan(SHODAN_API_KEY)
# Perform the search
query = 'QUERY_HERE'
results = api.search(query)
# Print total results found
print(f'Results found: {results["total"]}')
# Iterate through the results and print raw data
for result in results['matches']:
print('\n------------------------')
print(f'IP: {result["ip_str"]}')
print(f'Port: {result["port"]}')
print(f'Organization: {result.get("org", "N/A")}')
print(f'Location: {result["location"]["country_name"]}')
print(f'Hostnames: {result.get("hostnames", [])}')
print('\nRaw Data:')
print(json.dumps(result, indent=2))
except shodan.APIError as e:
print(f'Error: {e}')
if __name__ == '__main__':
search_shodan()
The text was updated successfully, but these errors were encountered:
Shodan API Error: Unable to parse JSON response
I'm encountering an error with the shodan-python library. My code worked yesterday but is now failing, despite no changes being made.
Here is a test code that produces the same error.
The text was updated successfully, but these errors were encountered: