Beispiel #1
0
class AlchemyKeyExtractor(BaseKeywordExtractor):
    def __init__(self, api_key):
        self.api_key = api_key
        self.alchemy_api = AlchemyAPI()
        self.alchemy_api.setAPIKey(self.api_key)

    def _fetch_url(self, url):
        try:
            result = self.alchemy_api.URLGetRankedKeywords(url)
        except Exception, e:
            return {'errorCode': 404, 'errors': str(e)}

        return result
Beispiel #2
0
class AlchemyLangDetector(BaseDetector):

    def __init__(self, api_key):
        self.api_key = api_key
        self.alchemy_api = AlchemyAPI()
        self.alchemy_api.setAPIKey(self.api_key)

    def _fetch_url(self, url):
        try:
            result = self.alchemy_api.URLGetLanguage(url)
        except Exception, e:
            return {'errorCode': 404, 'errors': str(e)}
        return result
Beispiel #3
0
 def __init__(self, api_key):
     self.api_key = api_key
     self.alchemy_api = AlchemyAPI()
     self.alchemy_api.setAPIKey(self.api_key)