client_1c_timesheet/api.py
def parse_json_clockify_error(self, error_text):
        """Parse response json string containing an API error from server into object

        Parameters
        ----------
        error_text: str
            json encoded error string received from API

        Raises
        ------
        APIResponseParseException
            When response text cannot be parsed as json or required information is missing from response

        Returns
        -------
        APIErrorResponse
        """
        parsed = self.parse_json(error_text)
        # 1C api odata errors use 'message' for human readable component.
        if 'odata.error' in parsed.keys():
            if 'message' in parsed['odata.error'].keys() and 'value' in parsed['odata.error']['message']:
                msg = parsed['odata.error']['message']['value']
            else:
                msg = f'Could not find "message" in {parsed}'
                raise APIResponseParseException(msg)
            if 'code' not in parsed['odata.error'].keys():
                msg = f'Could not find "code" in {parsed}'
                raise APIResponseParseException(msg)
        return APIErrorResponse(code=parsed['odata.error']['code'], message=msg)
Parse response json string containing an API error from server into object

        Parameters
        ----------
        error_text: str
            json encoded error string received from API

        Raises
        ------
        APIResponseParseException
            When response text cannot be parsed as json or required information is missing from response

        Returns
        -------
        APIErrorResponse
        
Parse response json string containing an API error from server into object
Parameters

str
json encoded error string received from API

Raises

APIResponseParseException
When response text cannot be parsed as json or required information is missing from response

Returns


Parse response json string containing an API error from server into object Parameters str json encoded error string received from API Raises APIResponseParseException When response text cannot be parsed as json or required information is missing from response Returns
def parse_json_clockify_error(self, error_text):
        parsed = self.parse_json(error_text)
        if 'odata.error' in parsed.keys():
            if 'message' in parsed['odata.error'].keys() and 'value' in parsed['odata.error']['message']:
                msg = parsed['odata.error']['message']['value']
            else:
                msg = f'Could not find "message" in {parsed}'
                raise APIResponseParseException(msg)
            if 'code' not in parsed['odata.error'].keys():
                msg = f'Could not find "code" in {parsed}'
                raise APIResponseParseException(msg)
        return APIErrorResponse(code=parsed['odata.error']['code'], message=msg)
def parse_json_clockify_error ( self , error_text ) : parsed = self . parse_json ( error_text ) if 'odata.error' in parsed . keys ( ) : if 'message' in parsed [ 'odata.error' ] . keys ( ) and 'value' in parsed [ 'odata.error' ] [ 'message' ] : msg = parsed [ 'odata.error' ] [ 'message' ] [ 'value' ] else : msg = f'Could not find "message" in {parsed}' raise APIResponseParseException ( msg ) if 'code' not in parsed [ 'odata.error' ] . keys ( ) : msg = f'Could not find "code" in {parsed}' raise APIResponseParseException ( msg ) return APIErrorResponse ( code = parsed [ 'odata.error' ] [ 'code' ] , message = msg )
Parse response json string containing an API error from server into object
Parameters
Parse response json string containing an API error from server into object Parameters
"""Parse response json string containing an API error from server into object

        Parameters
        ----------
        error_text: str
            json encoded error string received from API

        Raises
        ------
        APIResponseParseException
            When response text cannot be parsed as json or required information is missing from response

        Returns
        -------
        APIErrorResponse
        """ # 1C api odata errors use 'message' for human readable component.
self
error_text