(self, function, params)
return data
General-purpose function to create web requests to SHODAN.

        Arguments:
        function  -- name of the function you want to execute
        params      -- dictionary of parameters for the function

        Returns
        A JSON string containing the function's results.
General-purpose function to create web requests to SHODAN.
General - purpose function to create web requests to SHODAN .
def _request(self, function, params):
        """General-purpose function to create web requests to SHODAN.

        Arguments:
        function  -- name of the function you want to execute
        params      -- dictionary of parameters for the function

        Returns
        A JSON string containing the function's results.

        """
        # Add the API key parameter automatically
        params['key'] = self.api_key

        # Send the request
        data = urlopen(
            self.base_url +
            function +
            '?' +
            urlencode(
                params)).read(
        )

        # Parse the text into JSON
        data = loads(data)

        # Raise an exception if an error occurred
        if data.get('error', None):
            raise WebAPIError(data['error'])

        # Return the data
        return data
def _request ( self , function , params ) : # Add the API key parameter automatically params [ 'key' ] = self . api_key # Send the request data = urlopen ( self . base_url + function + '?' + urlencode ( params ) ) . read ( ) # Parse the text into JSON data = loads ( data ) # Raise an exception if an error occurred if data . get ( 'error' , None ) : raise WebAPIError ( data [ 'error' ] ) # Return the data return data