notifo/notifo.py
def _query(self, url, data = None):
        """ query method to do HTTP POST/GET

            Parameters:
                url -> the url to POST/GET
                data -> header_data as a dict (only for POST)

            Returns:
                Parsed JSON data as dict
                or
                None on error
        """
        auth = encodestring('%s:%s' % (self.user, self.secret)).replace('\n', '')

        if data is not None: # we have POST data if there is data
            values = urllib.urlencode(data)
            request = urllib2.Request(url, values)
            request.add_header("Authorization", "Basic %s" % auth)
        else: # do a GET otherwise
            request = urllib2.Request(url)
            request.add_header("Authorization", "Basic %s" % auth)
        try:
            response = urllib2.urlopen(request)
        except IOError, e: # no connection
            return {"status" : "error",
                    "response_code" : e.code,
                    "response_message" : e.msg
                   }
        return json.loads(response.read())
def _query(self, url, data = None):
        """ query method to do HTTP POST/GET

            Parameters:
                url -> the url to POST/GET
                data -> header_data as a dict (only for POST)

            Returns:
                Parsed JSON data as dict
                or
                None on error
        """
        auth = encodestring('%s:%s' % (self.user, self.secret)).replace('\n', '')

        if data is not None: # we have POST data if there is data
            values = urllib.urlencode(data)
            request = urllib2.Request(url, values)
            request.add_header("Authorization", "Basic %s" % auth)
        else: # do a GET otherwise
            request = urllib2.Request(url)
            request.add_header("Authorization", "Basic %s" % auth)
        try:
            response = urllib2.urlopen(request)
        except IOError, e: # no connection
            return {"status" : "error",
                    "response_code" : e.code,
                    "response_message" : e.msg
                   }
        return json.loads(response.read())
query method to do HTTP POST/GET

            Parameters:
                url -> the url to POST/GET
                data -> header_data as a dict (only for POST)

            Returns:
                Parsed JSON data as dict
                or
                None on error