Esempio n. 1
0
 def test_create_note(self):
     note = create_note(notebook_guid='test', title='test', content='<html><body>hello</body></html>')
     self.assertTrue(note.content.startswith('<?xml version="1.0" encoding="UTF-8"?'
                                             '><!DOCTYPE en-note SYSTEM "http://xml.'
                                             'evernote.com/pub/enml2.dtd">'))
     self.assertTrue(note.content.endswith('</en-note>'))
     self.assertEqual(note.title, 'test')
     self.assertEqual(note.notebookGuid, 'test')
Esempio n. 2
0
    def add_article(self, article_id: int) -> str:
        article = Article.objects.get(id=article_id)
        note = create_note(notebook_guid=self.e_guid, title=article.title, content=article.content)

        try:
            client = self.get_evernote_client()
            note_store = client.get_note_store()
            created_note = note_store.createNote(note)
            article.saved = True
            article.save()
        except Exception as _:
            log.warning("Evernote rate limit encountered!")
            return ""
        return created_note.guid