This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def shareSingleNote(authToken, noteStore, userStore, noteGuid, shardId=None): | |
""" | |
Share a single note and return the public URL for the note | |
""" | |
if not shardId: | |
shardId = getUserShardId(authToken, userStore) | |
if not shardId: | |
raise SystemExit | |
try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getUserShardId(authToken, userStore): | |
""" | |
Get the User from userStore and return the user's shard ID | |
""" | |
try: | |
user = userStore.getUser(authToken) | |
except (Errors.EDAMUserException, Errors.EDAMSystemException), e: | |
print "Exception while getting user's shardID:" | |
print type(e), e | |
return None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def makeNote(authToken, noteStore, noteTitle, noteBody, resources=[], parentNotebook=None): | |
""" | |
Create a Note instance with title and body | |
Send Note object to user's account | |
""" | |
ourNote = Types.Note() | |
ourNote.title = noteTitle | |
## Build body of note |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def makeResourceFromFiles(fpaths): | |
""" | |
Create a Resource object from the passed file(s) and return it | |
""" | |
for fpath in fpaths: | |
if not os.path.exists(fpath): | |
print "Path doesn't exist: %s" % fpath | |
continue | |
# try to determine the MIME type of the file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def makeNote(authToken, noteStore, noteTitle, noteBody, parentNotebook=None): | |
nBody = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | |
nBody += "<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">" | |
nBody += "<en-note>%s</en-note>" % noteBody | |
## Create note object | |
ourNote = Types.Note() | |
ourNote.title = noteTitle | |
ourNote.content = nBody |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
noteStore = client.get_note_store() | |
notebook = Types.Notebook() | |
notebook.name = "My Notebook" | |
notebook = noteStore.createNotebook(notebook) | |
print notebook.guid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
noteStore = client.get_note_store() | |
note = Types.Note() | |
note.title = "I'm a test note!" | |
note.content = '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">' | |
note.content += '<en-note>Hello, world!</en-note>' | |
note = noteStore.createNote(note) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import re | |
from enauath import client | |
from string import Template | |
#Accepts the GUID(string) of the note you want to append | |
def appendNote(guid): | |
#Get the note to be updated using the note's guid http://dev.evernote.com/documentation/reference/NoteStore.html#Fn_NoteStore_getNote |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Allow an application to activate a running instance of itself instead of | |
starting another instance. | |
""" | |
## Usage ## | |
# import sys | |
# APP_ID = "com.example.application" | |
# if activate_if_already_running(APP_ID): | |
# sys.exit(0) | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simulated just matched /* | |
stream = " /* /* /* /* */ */ */ */ /* */ /* */ */ /**/" | |
# stream = "/*/*/*/**/*/*/*//**//**/*/ /**/" | |
# stream = """ | |
# /* | |
# Some random comment | |
# */ | |
# // More text | |
# var i = "5"; |