Example #1
0
    def login(self, username = None, password = None):
        username = username or self.username
        password = password or self.password
        if not (username and password):
            raise e.LoginError('username or password is empty')

        response = api_request(urls.login_valid, data = {
            'username'      :       username,
            'password'      :       util.md5(password),
            'product'       :       'YNOTE',
            'tp'            :       'urstoken',
            'cf'            :       '6',
            'fr'            :       '1',
            'systemName'    :       'linux',
            'deviceType'    :       'linuxPC',
            'er'            :       'http://note.youdao.com/signIn//loginCallback.html',
            'ru'            :       'http://note.youdao.com/signIn//loginCallback.html',
            })
        if not self.is_logged():
            raise e.LoginError('user valid failed')
        api_request(urls.user_cstk)
Example #2
0
    def ls(self):
        response = api.api_request(urls.list_notebooks)
        notebooks = []
        for record in response:
            if not record['tl']:
                continue
            notebook = NoteBook(record['tl'],
                    record['p'],
                    record['nn'])
            notebooks.append(notebook)

        return notebooks
Example #3
0
    def ls(self):
        """list the notebook all notes"""
        response = api.api_request(urls.list_notes, 'POST', 
                data = {
                    'b'     :   '0',
                    'l'     :   '200',
                    'm'     :   '0',
                    'nb'    :   self.guid,
                    'v'     :   '-1',
                    })
        total, records = response
        notes = []
        for record in records:
            _note = note.Note(self, record['tl'], record['p'])
            notes.append(_note)

        return notes
Example #4
0
 def data(self):
     response = api.api_request(urls.note_data, data={'p': self.guid})
     return NoteData(response)
Example #5
0
 def data(self):
     return api.api_request(self.url)
Example #6
0
 def data(self):
     response = api.api_request(urls.note_data,
             data = {'p': self.guid})
     return NoteData(response)
Example #7
0
 def data(self):
     return api.api_request(self.url)