def analyze_content(obj, content, content_type='text/txt', api=None): if api is None: api = OpenCalais(settings.CALAIS_API_KEY) return api.analyze(content, content_type=content_type)
def analyze_content_field(obj, field_name, content_type='text/txt', api=None): if api is None: api = OpenCalais(settings.CALAIS_API_KEY) content = getattr(obj, field_name) return api.analyze(content, content_type=content_type)
def analyze_url_field(obj, field_name, content_type='text/html', api=None): if api is None: api = OpenCalais(settings.CALAIS_API_KEY) url = getattr(obj, field_name) return api.analyze_url(url, content_type=content_type)