def stage_tc_create_attribute(self, attribute_type, attribute_value, resource):
        """Add an attribute to a resource.

        Args:
            attribute_type (str): The attribute type (e.g., Description).
            attribute_value (str): The attribute value.
            resource (obj): An instance of tcex resource class.
        """
        attribute_data = {'type': str(attribute_type), 'value': str(attribute_value)}
        # handle default description and source
        if attribute_type in ['Description', 'Source']:
            attribute_data['displayed'] = True

        attrib_resource = resource.attributes()
        attrib_resource.body = json.dumps(attribute_data)
        attrib_resource.http_method = 'POST'

        # add the attribute
        a_response = attrib_resource.request()
        if a_response.get('status') != 'Success':
            self.log.warning(
                '[stage] Failed adding attribute type "{}":"{}" ({}).'.format(
                    attribute_type, attribute_value, a_response.get('response').text
                )
            )
def stage_tc_create_attribute ( self , attribute_type , attribute_value , resource ) : attribute_data = { 'type' : str ( attribute_type ) , 'value' : str ( attribute_value ) } if attribute_type in [ 'Description' , 'Source' ] : attribute_data [ 'displayed' ] = True attrib_resource = resource . attributes ( ) attrib_resource . body = json . dumps ( attribute_data ) attrib_resource . http_method = 'POST' a_response = attrib_resource . request ( ) if a_response . get ( 'status' ) != 'Success' : self . log . warning ( '[stage] Failed adding attribute type "{}":"{}" ({}).' . format ( attribute_type , attribute_value , a_response . get ( 'response' ) . text ) )
Add an attribute to a resource.

        Args:
            attribute_type (str): The attribute type (e.g., Description).
            attribute_value (str): The attribute value.
            resource (obj): An instance of tcex resource class.