StackSentinel/__init__.py
def send_error(self, error_type, error_message, traceback, environment, state, tags=None,
                   return_feedback_urls=False):
        """
        Sends error payload to Stack Sentinel API, returning a parsed JSON response. (Parsed as in,
        converted into Python dict/list objects)

        :param error_type: Type of error generated. (Eg, "TypeError")
        :param error_message: Message of error generated (Eg, "cannot concatenate 'str' and 'int' objects")
        :param traceback: List of dictionaries. Each dictionary should contain, "line", "method", and "module" keys.
        :param environment: Environment the error occurred in (eg, "devel")_
        :param state: State of the application when the error happened. Could contain form data, cookies, etc.
        :param tags: Arbitrary tags you want associated with the error. list.
        :param return_feedback_urls: If True, return payload will offer URLs to send users to collect additional feedback for debugging.
        :return: Parsed return value from Stack Sentinel API
        """

        (request, payload) = self._generate_request(environment, error_message, error_type, return_feedback_urls,
                                                    state, tags, traceback)
        try:
            response = urlopen(request)
        except HTTPError as e:
            if e.code == 400:
                raise StackSentinelError(e.read())
            else:
                raise

        if sys.version_info.major > 2:
            text_response = response.read().decode(response.headers.get_content_charset() or 'utf8')
        else:
            encoding = response.headers.get('content-type', '').split('charset=')[-1].strip()
            if encoding:
                text_response = response.read().decode('utf8', 'replace')
            else:
                text_response = response.read().decode(encoding)

        return json.loads(text_response)
def send_error(self, error_type, error_message, traceback, environment, state, tags=None,
                   return_feedback_urls=False):
        """
        Sends error payload to Stack Sentinel API, returning a parsed JSON response. (Parsed as in,
        converted into Python dict/list objects)

        :param error_type: Type of error generated. (Eg, "TypeError")
        :param error_message: Message of error generated (Eg, "cannot concatenate 'str' and 'int' objects")
        :param traceback: List of dictionaries. Each dictionary should contain, "line", "method", and "module" keys.
        :param environment: Environment the error occurred in (eg, "devel")_
        :param state: State of the application when the error happened. Could contain form data, cookies, etc.
        :param tags: Arbitrary tags you want associated with the error. list.
        :param return_feedback_urls: If True, return payload will offer URLs to send users to collect additional feedback for debugging.
        :return: Parsed return value from Stack Sentinel API
        """

        (request, payload) = self._generate_request(environment, error_message, error_type, return_feedback_urls,
                                                    state, tags, traceback)
        try:
            response = urlopen(request)
        except HTTPError as e:
            if e.code == 400:
                raise StackSentinelError(e.read())
            else:
                raise

        if sys.version_info.major > 2:
            text_response = response.read().decode(response.headers.get_content_charset() or 'utf8')
        else:
            encoding = response.headers.get('content-type', '').split('charset=')[-1].strip()
            if encoding:
                text_response = response.read().decode('utf8', 'replace')
            else:
                text_response = response.read().decode(encoding)

        return json.loads(text_response)
Sends error payload to Stack Sentinel API, returning a parsed JSON response. (Parsed as in,
        converted into Python dict/list objects)

        :param error_type: Type of error generated. (Eg, "TypeError")
        :param error_message: Message of error generated (Eg, "cannot concatenate 'str' and 'int' objects")
        :param traceback: List of dictionaries. Each dictionary should contain, "line", "method", and "module" keys.
        :param environment: Environment the error occurred in (eg, "devel")_
        :param state: State of the application when the error happened. Could contain form data, cookies, etc.
        :param tags: Arbitrary tags you want associated with the error. list.
        :param return_feedback_urls: If True, return payload will offer URLs to send users to collect additional feedback for debugging.
        :return: Parsed return value from Stack Sentinel API