Esempio n. 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)
Esempio n. 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
Esempio n. 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
Esempio n. 4
0
 def data(self):
     response = api.api_request(urls.note_data, data={'p': self.guid})
     return NoteData(response)
Esempio n. 5
0
 def data(self):
     return api.api_request(self.url)
Esempio n. 6
0
 def data(self):
     response = api.api_request(urls.note_data,
             data = {'p': self.guid})
     return NoteData(response)
Esempio n. 7
0
 def data(self):
     return api.api_request(self.url)