當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。