当前位置: 首页>>代码示例>>Python>>正文


Python client.EvernoteClient方法代码示例

本文整理汇总了Python中evernote.api.client.EvernoteClient方法的典型用法代码示例。如果您正苦于以下问题:Python client.EvernoteClient方法的具体用法?Python client.EvernoteClient怎么用?Python client.EvernoteClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在evernote.api.client的用法示例。


在下文中一共展示了client.EvernoteClient方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_request_token

# 需要导入模块: from evernote.api import client [as 别名]
# 或者: from evernote.api.client import EvernoteClient [as 别名]
def get_request_token(user, callback):
    '''
    Get request token
    '''
    from settings import secrets
    client = EvernoteClient(
        consumer_key=secrets.EVERNOTE_CONSUMER_KEY,
        consumer_secret=secrets.EVERNOTE_CONSUMER_SECRET,
        sandbox=SANDBOX
    )
    request_token = client.get_request_token(callback)
    logging.debug(request_token)
    # Save secret
    memcache.set(SECRET_MCK % user.key.id(), request_token['oauth_token_secret'])
    authorize_url = client.get_authorize_url(request_token)
    return authorize_url 
开发者ID:onejgordon,项目名称:flow-dashboard,代码行数:18,代码来源:flow_evernote.py

示例2: get_note

# 需要导入模块: from evernote.api import client [as 别名]
# 或者: from evernote.api.client import EvernoteClient [as 别名]
def get_note(user, note_id):
    STRIP_WORDS = ["Pocket:"]
    title = url = content = None
    access_token = user_access_token(user)
    if access_token:
        client = EvernoteClient(token=access_token, sandbox=SANDBOX)
        noteStore = client.get_note_store()
        note = noteStore.getNote(access_token, note_id, True, False, False, False)
        if note:
            logging.debug(note)
            content = extract_clipping_content(note.content)
            title = note.title
            uid = note.guid
            for sw in STRIP_WORDS:
                if sw in title:
                    title = title.replace(sw, '')
            title = title.strip()
            attrs = note.attributes
            if attrs:
                url = attrs.sourceURL
        else:
            logging.debug("Note not found")
    else:
        logging.warning("Access token not available")
    return (uid, title, content, url) 
开发者ID:onejgordon,项目名称:flow-dashboard,代码行数:27,代码来源:flow_evernote.py

示例3: _get_client

# 需要导入模块: from evernote.api import client [as 别名]
# 或者: from evernote.api.client import EvernoteClient [as 别名]
def _get_client():
	global _client
	if _client is None:
		log_progress('login to evernote')
		_client = EvernoteClient(token=_auth_token, sandbox=False)
	return _client 
开发者ID:lukaskollmer,项目名称:pythonista-scripts,代码行数:8,代码来源:LKEvernoteApi.py

示例4: __init__

# 需要导入模块: from evernote.api import client [as 别名]
# 或者: from evernote.api.client import EvernoteClient [as 别名]
def __init__(self, *args):
        super(EvernoteModule, self).__init__(*args)
        self.auth_token = self.get_configuration('evernote_auth_token')
        if self.auth_token:
            self.client = EvernoteClient(token=self.auth_token, sandbox=False)
            self.user_store = self.client.get_user_store()
            self.note_store = self.client.get_note_store()
        else:
            return False 
开发者ID:SlapBot,项目名称:stephanie-va,代码行数:11,代码来源:evernote_module.py

示例5: _connect_to_evernote

# 需要导入模块: from evernote.api import client [as 别名]
# 或者: from evernote.api.client import EvernoteClient [as 别名]
def _connect_to_evernote(self, dictUserInfo):
        """
            Establish a connection to evernote and authenticate.

            :param dictUserInfo: Dict of user info like user/passwrod.  For now, just the dev token
            :returns success: Return wheter connection succeeded
            :rtype bool:
        """
        print("Authenticating to Evernote")
        dev_token = dictUserInfo['dev_token']
        logging.debug("Authenticating using token %s" % dev_token)
        user = None
        try:
            self.client = EvernoteClient(token=dev_token, sandbox=False)
            self.user_store = self.client.get_user_store()
            user = self.user_store.getUser()
        except EDAMUserException as e:
            err = e.errorCode
            print("Error attempting to authenticate to Evernote: %s - %s" % (EDAMErrorCode._VALUES_TO_NAMES[err], e.parameter))
        except EDAMSystemException as e:
            err = e.errorCode
            print("Error attempting to authenticate to Evernote: %s - %s" % (EDAMErrorCode._VALUES_TO_NAMES[err], e.message))
            sys.exit(-1)

        if user:
            print("Authenticated to evernote as user %s" % user.username)
        return True 
开发者ID:mplitnikas,项目名称:pdf_liberty,代码行数:29,代码来源:pypdfocr_filer_evernote.py

示例6: __init__

# 需要导入模块: from evernote.api import client [as 别名]
# 或者: from evernote.api.client import EvernoteClient [as 别名]
def __init__(self, token, isSpecialToken = False, sandbox = False, isInternational = False, notebooks = None):
        self.token = token
        if sandbox:
            self.client = EvernoteClient(token=self.token)
        elif isInternational:
            self.client = EvernoteClient(token=self.token, service_host='www.evernote.com')
        else:
            self.client = EvernoteClient(token=self.token, service_host='app.yinxiang.com')
        self.isSpecialToken = isSpecialToken
        self.userStore = self.client.get_user_store()
        self.noteStore = self.client.get_note_store()
        self.storage = Storage(notebooks) 
开发者ID:littlecodersh,项目名称:LocalNote,代码行数:14,代码来源:controller.py

示例7: __init__

# 需要导入模块: from evernote.api import client [as 别名]
# 或者: from evernote.api.client import EvernoteClient [as 别名]
def __init__(self):
        if DEV_TOKEN:
            self.token = DEV_TOKEN
        else:
            self.token = Oauth(SANDBOX).oauth()

        sys.stdout.write('Logging\r')
        if SANDBOX:
            self.client = EvernoteClient(token=self.token)
        else:
            self.client = EvernoteClient(token=self.token, service_host=SERVICE_HOST)
        self.userStore = self.client.get_user_store()
        self.noteStore = self.client.get_note_store()
        if LOCAL_STORAGE: self.__set_storage()
        print 'Login Succeed as ' + self.userStore.getUser().username 
开发者ID:littlecodersh,项目名称:EasierLife,代码行数:17,代码来源:EvernoteController.py

示例8: __init__

# 需要导入模块: from evernote.api import client [as 别名]
# 或者: from evernote.api.client import EvernoteClient [as 别名]
def __init__(self, token, isSpecialToken = False, sandbox = False, isInternational = False):
        self.token = token
        if sandbox:
            self.client = EvernoteClient(token=self.token)
        elif isInternational:
            self.client = EvernoteClient(token=self.token, service_host='app.evernote.com')
        else:
            self.client = EvernoteClient(token=self.token, service_host='app.yinxiang.com')
        self.isSpecialToken = isSpecialToken
        self.userStore = self.client.get_user_store()
        self.noteStore = self.client.get_note_store()
        self.storage = Storage() 
开发者ID:littlecodersh,项目名称:EasierLife,代码行数:14,代码来源:controller.py

示例9: handle

# 需要导入模块: from evernote.api import client [as 别名]
# 或者: from evernote.api.client import EvernoteClient [as 别名]
def handle(text, mic, profile):

        auth_token = profile["EVERNOTE_TOKEN"]

        client = EvernoteClient(token=auth_token, sandbox=False)
        user_store = client.get_user_store()
        note_store = client.get_note_store()

        if bool(re.search(r'\Note\b', text, re.IGNORECASE)):
                writeNote(text, mic, note_store) 
开发者ID:mattcurrycom,项目名称:jasper-modules,代码行数:12,代码来源:Evernote.py

示例10: get_access_token

# 需要导入模块: from evernote.api import client [as 别名]
# 或者: from evernote.api.client import EvernoteClient [as 别名]
def get_access_token(user, oauth_token, oauth_verifier):
    '''
    Get request token
    '''
    from settings import secrets
    client = EvernoteClient(
        consumer_key=secrets.EVERNOTE_CONSUMER_KEY,
        consumer_secret=secrets.EVERNOTE_CONSUMER_SECRET,
        sandbox=SANDBOX
    )
    access_token = en_user_id = None
    access_token_dict = {}
    oauth_token_secret = memcache.get(SECRET_MCK % user.key.id())
    if oauth_token_secret:
        try:
            access_token_dict = client.get_access_token_dict(
                oauth_token,
                oauth_token_secret,
                oauth_verifier
            )
        except KeyError:
            logging.warning("KeyError getting Evernote access token")
        en_user_id = access_token_dict.get('edam_userId')
        access_token = access_token_dict.get('oauth_token')
    else:
        logging.warning("oauth_token_secret unavailable")
    return (access_token, en_user_id) 
开发者ID:onejgordon,项目名称:flow-dashboard,代码行数:29,代码来源:flow_evernote.py

示例11: login

# 需要导入模块: from evernote.api import client [as 别名]
# 或者: from evernote.api.client import EvernoteClient [as 别名]
def login(self):
    """
    login Evernote
    """
        if self._test:
            return True

        log.debug('Start to login')
        yx = False
        if self.account_type == 'yinxiang':
            yx = True
            log.debug('Account type:' + 'yinxiang')
        else:
            log.debug('Account type:' + 'evernote')

        try:
            self.client = EvernoteClient(token=self.auth_token, sandbox=False, yinxiang=yx)
            self.user_store = self.client.get_user_store()
            version_ok = self.user_store.checkVersion("Evernote EDAMTest (Python)",
                                                      UserStoreConstants.EDAM_VERSION_MAJOR,
                                                      UserStoreConstants.EDAM_VERSION_MINOR)
            if not version_ok:
                log.error('Evernote SDK version not up to data')
                return False
            self.note_store = self.client.get_note_store()
            log.info('Login succeed')
            return True
        except:
            log.debug(traceback.format_exc())
            log.error('Login failed') 
开发者ID:liuwons,项目名称:EverMark,代码行数:32,代码来源:evermark.py


注:本文中的evernote.api.client.EvernoteClient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。