MCPcopy Create free account
hub / github.com/achillean/shodan-python / create_facet_string

Function create_facet_string

shodan/helpers.py:13–24  ·  view source on GitHub ↗

Converts a Python list of facets into a comma-separated string that can be understood by the Shodan API.

(facets)

Source from the content-addressed store, hash-verified

11
12
13def create_facet_string(facets):
14 """Converts a Python list of facets into a comma-separated string that can be understood by
15 the Shodan API.
16 """
17 facet_str = ''
18 for facet in facets:
19 if isinstance(facet, basestring):
20 facet_str += facet
21 else:
22 facet_str += '{}:{}'.format(facet[0], facet[1])
23 facet_str += ','
24 return facet_str[:-1]
25
26
27def api_request(key, function, params=None, data=None, base_url='https://api.shodan.io',

Callers 4

searchMethod · 0.85
countMethod · 0.85
countMethod · 0.85
searchMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected