def _query(self, url=None, params=""):
        """ method to query a URL with the given parameters

            Parameters:
                url -> URL to query
                params -> dictionary with parameter values

            Returns: HTTP response code, headers
                     If an exception occurred, headers fields are None
        """
        if url is None:
            raise NoUrlError("No URL was provided.")
        # return values
        headers = {'location': None, 'title': None}
        headerdata = urllib.urlencode(params)
        try:
            request = urllib2.Request(url, headerdata)
            response = urllib2.urlopen(request)
            # return numeric HTTP status code unless JSONP was requested
            if 'jsonp' in params:
                status = response.read()
            else:
                status = response.getcode()
            info = response.info()

            try:
                headers['location'] = info['Content-Location']
            except KeyError:
                pass
            try:
                headers['title'] = info['X-Instapaper-Title']
            except KeyError:
                pass
            return (status, headers)
        except urllib2.HTTPError as exception:
            # handle API not returning JSONP response on 403
            if 'jsonp' in params:
                return ('%s({"status":%d})' % (params['jsonp'], exception.code), headers)
            else:
                return (exception.code, headers)
        except IOError as exception:
            return (exception.code, headers)

# instapaper specific exceptions
dataset/ETHPy150Open mrtazz/InstapaperLibrary/instapaperlib/instapaperlib.py/Instapaper._query/original