Permalink
Browse files

Big update. Added editing of the contents of a note via the system ed…

…itor. Added saving oAuthToken to the storage.
  • Loading branch information...
1 parent fd736d3 commit dd70105e88db57b0e2160b92befbf6e62e84cf70 @stepler stepler committed Jun 6, 2012
Showing with 40,391 additions and 40,253 deletions.
  1. +27 −27 .gitignore
  2. +16 −16 README.md
  3. +14 −14 bash_completion/geeknote
  4. +58 −0 editor.py
  5. +493 −445 geeknote.py
  6. +201 −169 io.py
  7. +1 −1 lib/evernote/edam/error/__init__.py
  8. +11 −11 lib/evernote/edam/error/constants.py
  9. +384 −384 lib/evernote/edam/error/ttypes.py
  10. +1 −1 lib/evernote/edam/limits/__init__.py
  11. +130 −130 lib/evernote/edam/limits/constants.py
  12. +18 −18 lib/evernote/edam/limits/ttypes.py
  13. +599 −599 lib/evernote/edam/notestore/NoteStore-remote
  14. +21,214 −21,214 lib/evernote/edam/notestore/NoteStore.py
  15. +1 −1 lib/evernote/edam/notestore/__init__.py
  16. +11 −11 lib/evernote/edam/notestore/constants.py
  17. +2,604 −2,604 lib/evernote/edam/notestore/ttypes.py
  18. +1 −1 lib/evernote/edam/type/__init__.py
  19. +14 −14 lib/evernote/edam/type/constants.py
  20. +4,267 −4,267 lib/evernote/edam/type/ttypes.py
  21. +137 −137 lib/evernote/edam/userstore/UserStore-remote
  22. +1,979 −1,979 lib/evernote/edam/userstore/UserStore.py
  23. +1 −1 lib/evernote/edam/userstore/__init__.py
  24. +13 −13 lib/evernote/edam/userstore/constants.py
  25. +1,015 −1,015 lib/evernote/edam/userstore/ttypes.py
  26. +451 −451 lib/html2text.py
  27. +125 −125 lib/sqlalchemy/__init__.py
  28. +10 −10 lib/sqlalchemy/connectors/__init__.py
  29. +150 −150 lib/sqlalchemy/connectors/mxodbc.py
  30. +150 −150 lib/sqlalchemy/connectors/mysqldb.py
  31. +163 −163 lib/sqlalchemy/connectors/pyodbc.py
  32. +58 −58 lib/sqlalchemy/connectors/zxJDBC.py
  33. +37 −37 lib/sqlalchemy/databases/__init__.py
  34. +19 −19 lib/sqlalchemy/dialects/__init__.py
  35. +450 −450 lib/sqlalchemy/dialects/access/base.py
  36. +22 −22 lib/sqlalchemy/dialects/drizzle/__init__.py
  37. +509 −509 lib/sqlalchemy/dialects/drizzle/base.py
  38. +53 −53 lib/sqlalchemy/dialects/drizzle/mysqldb.py
  39. +22 −22 lib/sqlalchemy/dialects/firebird/__init__.py
  40. +700 −700 lib/sqlalchemy/dialects/firebird/base.py
  41. +167 −167 lib/sqlalchemy/dialects/firebird/kinterbasdb.py
  42. +8 −8 lib/sqlalchemy/dialects/informix/__init__.py
  43. +593 −593 lib/sqlalchemy/dialects/informix/base.py
  44. +73 −73 lib/sqlalchemy/dialects/informix/informixdb.py
  45. +8 −8 lib/sqlalchemy/dialects/maxdb/__init__.py
  46. +1,116 −1,116 lib/sqlalchemy/dialects/maxdb/base.py
  47. +22 −22 lib/sqlalchemy/dialects/maxdb/sapdb.py
  48. +25 −25 lib/sqlalchemy/dialects/mssql/__init__.py
  49. +69 −69 lib/sqlalchemy/dialects/mssql/adodbapi.py
  50. +1,531 −1,531 lib/sqlalchemy/dialects/mssql/base.py
  51. +96 −96 lib/sqlalchemy/dialects/mssql/information_schema.py
  52. +93 −93 lib/sqlalchemy/dialects/mssql/mxodbc.py
  53. +108 −108 lib/sqlalchemy/dialects/mssql/pymssql.py
  54. +251 −251 lib/sqlalchemy/dialects/mssql/pyodbc.py
  55. +75 −75 lib/sqlalchemy/dialects/mssql/zxjdbc.py
  56. +27 −27 lib/sqlalchemy/dialects/mysql/__init__.py
Sorry, we could not display the entire diff because it was too big.
View
54 .gitignore
@@ -1,27 +1,27 @@
-*.py[co]
-
-# Packages
-*.egg
-*.egg-info
-dist
-build
-eggs
-parts
-bin
-var
-sdist
-develop-eggs
-.installed.cfg
-
-# Installer logs
-pip-log.txt
-
-# Unit test / coverage reports
-.coverage
-.tox
-
-#Translations
-*.mo
-
-#Mr Developer
-.mr.developer.cfg
+*.py[co]
+
+# Packages
+*.egg
+*.egg-info
+dist
+build
+eggs
+parts
+bin
+var
+sdist
+develop-eggs
+.installed.cfg
+
+# Installer logs
+pip-log.txt
+
+# Unit test / coverage reports
+.coverage
+.tox
+
+#Translations
+*.mo
+
+#Mr Developer
+.mr.developer.cfg
View
32 README.md
@@ -1,17 +1,17 @@
-geeknote
-========
-
-Geeknote - is a command line client for Evernote, that can be use on Linux, FreeBSD and OS X.
-It allows you to:
- * save notes in your Evernote account;
- * make search;
- * edit note directly in console using any editor;
- * save URL to your Evernote in formats: clean (text only), clean + pdf (pdf format).
- * … ect.
-
-It can be used by:
- * really geeks who love console commands and love Evernote.
- * system administrators who can use Evernote as a log database for some important messages.
- * developers in their projects.
-
+geeknote
+========
+
+Geeknote - is a command line client for Evernote, that can be use on Linux, FreeBSD and OS X.
+It allows you to:
+ * save notes in your Evernote account;
+ * make search;
+ * edit note directly in console using any editor;
+ * save URL to your Evernote in formats: clean (text only), clean + pdf (pdf format).
+ * … ect.
+
+It can be used by:
+ * really geeks who love console commands and love Evernote.
+ * system administrators who can use Evernote as a log database for some important messages.
+ * developers in their projects.
+
Geeknote has been written on Python, so you can use open source package anywhere you have Python, even in Windows if you like.
View
28 bash_completion/geeknote
@@ -1,15 +1,15 @@
-_geeknote_command()
-{
- COMPREPLY=()
- cur="${COMP_WORDS[COMP_CWORD]}"
-
- SAVE_IFS=$IFS
- IFS=" "
- args="${COMP_WORDS[*]}"
- IFS=$SAVE_IFS
-
- COMPREPLY=( $(compgen -W "`python /home/skaizer/geeknote_autocomplete.py ${args}`" -- ${cur}) )
-
- return 0
-}
+_geeknote_command()
+{
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+
+ SAVE_IFS=$IFS
+ IFS=" "
+ args="${COMP_WORDS[*]}"
+ IFS=$SAVE_IFS
+
+ COMPREPLY=( $(compgen -W "`python /home/skaizer/geeknote_autocomplete.py ${args}`" -- ${cur}) )
+
+ return 0
+}
complete -F _geeknote_command geeknote
View
58 editor.py
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+import os, sys
+PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
+EVERNOTE_SDK = os.path.join(PROJECT_ROOT, 'lib')
+sys.path.append( EVERNOTE_SDK )
+
+import tempfile
+import html2text
+import markdown
+from tools import confirm
+
+def ENMLtoText(contentENML):
+ contentENML = contentENML.decode('utf-8')
+ content = html2text.html2text(contentENML)
+ return content.encode('utf-8')
+
+def textToENML(content):
+ """
+ Create an ENML format of note.
+ """
+ content = unicode(content,"utf-8")
+ contentENML = markdown.markdown(content).encode("utf-8")
+
+ body = '<?xml version="1.0" encoding="UTF-8"?>'
+ body += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">'
+ body += '<en-note>%s</en-note>' % contentENML
+ return body
+
+def edit(content=None):
+ """
+ Call the system editor, that types as a default in the system.
+ Editing goes in markdown format, and then the markdown converts into HTML, before uploading to Evernote.
+ """
+ if content is None:
+ content = ""
+
+ if not isinstance(content, str):
+ raise Exception("Note content must be an instanse of string, '%s' given." % type(content))
+
+ (tmpFileHandler, tmpFileName) = tempfile.mkstemp()
+
+ os.write(tmpFileHandler, ENMLtoText(content))
+ os.close(tmpFileHandler)
+
+ # Try to find default editor in the system.
+ editor = os.environ.get("editor")
+ if not (editor):
+ editor = os.environ.get("EDITOR")
+ if not (editor):
+ # If default editor is not finded, then use nano as a default.
+ editor = "nano"
+
+ # Make a system call to open file for editing.
+ os.system(editor + " " + tmpFileName)
+
+ newContent = open(tmpFileName, 'r').read()
+
+ return textToENML(newContent)
View
938 geeknote.py
@@ -1,445 +1,493 @@
-# -*- coding: utf-8 -*-
-# add Evernote SDK
-import os, sys
-PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
-EVERNOTE_SDK = os.path.join(PROJECT_ROOT, 'lib')
-sys.path.append( EVERNOTE_SDK )
-
-import sys
-import hashlib
-import binascii
-import time
-import thrift.protocol.TBinaryProtocol as TBinaryProtocol
-import thrift.transport.THttpClient as THttpClient
-import evernote.edam.userstore.UserStore as UserStore
-import evernote.edam.userstore.constants as UserStoreConstants
-import evernote.edam.notestore.NoteStore as NoteStore
-import evernote.edam.type.ttypes as Types
-import evernote.edam.error.ttypes as Errors
-import argparse
-import locale
-import time
-
-import io
-from oauth import GeekNoteAuth
-import tools
-from log import logging
-
-CONSUMER_KEY = 'skaizer-1250'
-CONSUMER_SECRET = 'ed0fcc0c97c032a5'
-
-class GeekNote:
-
- consumerKey = CONSUMER_KEY
- consumerSecret = CONSUMER_SECRET
- userStoreUri = "https://sandbox.evernote.com/edam/user"
- authToken = None
- #authToken = "S=s1:U=2265a:E=13ee295740c:C=1378ae4480c:P=185:A=stepler-8439:H=8bfb5c7a5bd5517eb885034cf5d515b2"
- userStore = None
- noteStore = None
-
- def __init__(self):
- self.getStorage()
- self.getSettings()
-
-
- self.checkVersion()
-
- #io.preloader.setMessage('Check OAuth Token..')
- self.checkAuth()
-
- def getStorage(self):
- # TODO access to sqlite
- pass
-
- def getSettings(self):
- # TODO load settings from storage
- pass
-
- def saveToken(self):
- # TODO save account to storage
- pass
-
- def checkVersion(self):
- userStoreHttpClient = THttpClient.THttpClient(self.userStoreUri)
- userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient)
- self.userStore = UserStore.Client(userStoreProtocol)
-
- versionOK = self.userStore.checkVersion("Python EDAMTest",
- UserStoreConstants.EDAM_VERSION_MAJOR,
- UserStoreConstants.EDAM_VERSION_MINOR)
- if not versionOK:
- print "Old EDAM version"
- exit(1)
-
- def checkAuth(self):
- # load from storage
-
- if self.authToken:
- return
-
- GNA = GeekNoteAuth()
- self.authToken = GNA.getToken()
- # print self.authToken
- # TODO save token to storage
-
- def getNoteStore(self):
-
- noteStoreUrl = self.userStore.getNoteStoreUrl(self.authToken)
- noteStoreHttpClient = THttpClient.THttpClient(noteStoreUrl)
- noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient)
- self.noteStore = NoteStore.Client(noteStoreProtocol)
-
- def findNotes(self, keywords, count):
- if not self.noteStore:
- self.getNoteStore()
-
- nf = NoteStore.NoteFilter()
- if keywords:
- nf.words = keywords
- return self.noteStore.findNotes(self.authToken, nf, 0, count)
-
- def getNote(self, name, full):
- notelist = self.findNotes(10,name)
- #for note in notelist.notes:
- if (len(notelist.notes) == 0):
- return None
- notelist.notes[0].content = self.noteStore.getNoteContent(self.authToken, notelist.notes[0].guid)
- return notelist.notes[0]
-
- def createNote(self, title, content, tags=None, notebook=None):
- if not self.noteStore:
- self.getNoteStore()
-
- note = Types.Note()
- note.title = title
- note.content = content
-
- if tags:
- note.tagNames = tags
-
- if notebook:
- note.notebookGuid = notebook
-
- logging.debug("New note : %s", note)
-
- try:
- self.noteStore.createNote(self.authToken, note)
- return True
- except Exception, e:
- logging.error("Error: %s", str(e))
- return False
-
- def updateNote(self, guid, title=None, content=None, tags=None, notebook=None):
- if not self.noteStore:
- self.getNoteStore()
-
- note = Types.Note()
- note.guid = guid
- if title:
- note.title = title
-
-
- if content:
- note.content = content
-
- if tags:
- note.tagNames = tags
-
- if notebook:
- note.notebookGuid = notebook
-
- logging.debug("Update note : %s", note)
-
- try:
- self.noteStore.updateNote(self.authToken, note)
- return True
- except Exception, e:
- logging.error("Error: %s", str(e))
- return False
-
- def deleteNote(self, guid):
- if not self.noteStore:
- self.getNoteStore()
-
- logging.debug("Delete note with guid: %s", guid)
- try:
- self.noteStore.deleteNote(self.authToken, guid)
- return True
- except Exception, e:
- logging.error("Error: %s", str(e))
- return False
-
-
-class Notes(object):
- """Работа с заметками"""
- evernote = None
-
- def connectToEvertone(self):
- if self.evernote:
- return
-
- io.preloader.setMessage("Connect to Evernote...")
-
- self.evernote = GeekNote()
- return self
-
- def create(self, title, body, tags=None, notepad=None):
-
- if body == "WRITE_IN_EDITOR":
- # TODO launch editor
- logging.debug("launch system editor")
-
- # TMP >>>
- if body and not body.startswith("<?xml"):
- content = body
- body = '<?xml version="1.0" encoding="UTF-8"?>'
- body += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">'
- body += '<en-note>%s</en-note>' % content
- # TMP <<<
-
- if tags:
- tags = tools.strip(tags.split(','))
-
- if notepad:
- # TODO search notebooks in storage
- logging.debug("search notebook")
-
- self.connectToEvertone()
- io.preloader.setMessage("Creating note...")
- result = self.evernote.createNote(title=title, content=body, tags=tags, notebook=notepad)
-
- if result:
- io.successMessage("Note successfully created")
- else:
- io.failureMessage("Error while creating the note")
-
- def edit(self, note, title=None, body=None, tags=None, notepad=None):
-
- note = self._searchNote(note)
-
- if not title:
- title = note['title']
-
- if body == "WRITE_IN_EDITOR":
- # TODO launch editor
- logging.debug("launch system editor")
-
- # TMP >>>
- if body and not body.startswith("<?xml"):
- content = body
- body = '<?xml version="1.0" encoding="UTF-8"?>'
- body += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">'
- body += '<en-note>%s</en-note>' % content
- # TMP <<<
-
- if tags:
- tags = tools.strip(tags.split(','))
-
- if notepad:
- # TODO search notebooks in storage
- logging.debug("search notebook")
-
- self.connectToEvertone()
- io.preloader.setMessage("Saving note...")
- result = self.evernote.updateNote(guid=note['guid'], title=title, content=body, tags=tags, notebook=notepad)
-
- if result:
- io.successMessage("Note successfully saved")
- else:
- io.failureMessage("Error while saving the note")
-
- def remove(self, note):
-
- note = self._searchNote(note)
-
- if not io.removeConfirm(note['title']):
- exit(1)
-
- self.connectToEvertone()
-
- io.preloader.setMessage("Deleting note...")
- result = self.evernote.deleteNote(note['guid'])
-
- if result:
- io.successMessage("Note successful deleted")
- else:
- io.failureMessage("Error while deleting the note")
-
- def _searchNote(self, note):
- note = tools.strip(note)
- if tools.checkIsInt(note):
- # TODO request in storage
- # TMP >>>
- result = self._search(1)
- note = result.notes[0]
- # TMP <<<
-
- else:
- request = "intitle:%s" % note if note else None
- logging.debug("Search notes: %s" % request)
- result = self._search(20, request)
-
- logging.debug("Search notes result: %s" % str(result))
- if result.totalNotes == 0:
- io.successMessage("Notes not found")
- exit(1)
-
- elif result.totalNotes == 1:
- note = result.notes[0]
-
- else:
- notes = dict( (index+1, {"title": item.title, "guid": item.guid}) for index, item in enumerate(result.notes) )
- logging.debug("Choose notes: %s" % str(notes))
- note = io.SelectSearchResult(notes)
-
- logging.debug("Found notes: %s" % str(note))
- return note
-
-
- def find(self, search=None, tags=None, notepads=None, date=None, count=None, exact_entry=None, content_search=None, url_only=None, ):
-
- request = ""
- if search:
- search = tools.strip(search)
- if exact_entry:
- search = '"%s"' % search
-
- if content_search:
- request += "any:%s " % search
- else:
- request += "intitle:%s " % search
-
- if tags:
- for tag in tools.strip(tags.split(',')):
-
- if tag.startswith('-'):
- request +="-tag:%s " % tag[1:]
- else:
- request +="tag:%s " % tag
-
- if date:
- date = tools.strip(date.split('-'))
- try:
- start_date = time.strptime(date[0], "%d.%m.%Y")
- request +="created:%s " % time.strftime("%Y%m%d", start_date)
-
- if len(date) == 2:
- request += "-created:%s " % time.strftime("%Y%m%d", time.strptime(date[1], "%d.%m.%Y"))
- else:
- request += "-created:%s " % time.strftime("%Y%m%d", time.gmtime(time.mktime(start_date)+60*60*24*2))
-
- except ValueError, e:
- io.failureMessage('Incorrect date format in --date attribute. Format: %s' % time.strftime("%d.%m.%Y", time.strptime('19991231', "%Y%m%d")))
- exit(1)
-
- if notepads:
- for notepad in tools.strip(notepads.split(',')):
- if notepad.startswith('-'):
- request += "-notebook:%s " % tools.strip(notepad[1:])
- else:
- request += "notebook:%s " % tools.strip(notepad)
-
- if not count:
- count = 20
-
- logging.debug("Search request: %s", request)
- logging.debug("Search count: %s", count)
-
- result = self._search(count, request)
-
- if result.totalNotes == 0:
- io.successMessage("Notes not found")
-
- notes = dict( (index+1, {"title": item.title, "guid": item.guid}) for index, item in enumerate(result.notes) )
- # TODO Save result to storage
-
- # print results
- io.SearchResult(notes, request)
-
- def _search(self, request, count):
- self.connectToEvertone()
- return self.evernote.findNotes(count, request)
-
-COMMANDS = {
- "create": {
- "help": "Create note",
- "arguments": {
- "--title": {"help": "Set note title", "required": True},
- "--body": {"help": "Set note content", "required": True},
- "--tags": {"help": "Add tag to note"},
- "--notepad": {"help": "Add location marker to note"}
- }
- },
- "edit": {
- "help": "Create note",
- "arguments": {
- "--note": {"help": "Set note title"},
- "--title": {"help": "Set note title"},
- "--body": {"help": "Set note content"},
- "--tags": {"help": "Add tag to note"},
- "--notepad": {"help": "Add location marker to note"}
- }
- },
- "remove": {
- "help": "Create note",
- "arguments": {
- "--note": {"help": "Set note title"},
- }
- },
- "find": {
- "help": "Create note",
- "arguments": {
- "--search": {"help": "Add tag to note"},
- "--tags": {"help": "Add tag to note"},
- "--notepads": {"help": "Add location marker to note"},
- "--date": {"help": "Add location marker to note"},
- "--count": {"help": "Add location marker to note"},
- },
- "flags": {
- "--exact-entry": {"help": "Add tag to note", "action": "store_true"},
- "--content-search": {"help": "Add tag to note", "action": "store_true"},
- "--url-only": {"help": "Add tag to note"},
- }
- },
-}
-
-if __name__ == "__main__":
-
- COMAND = sys.argv[1] if len(sys.argv) >= 2 else ""
-
- # run check & run autocomplete
- if COMAND == "autocomplete":
- tools.printAutocomplete(COMMANDS, sys.argv[2:])
- exit(1)
-
- # create CLI parcer
- parser = argparse.ArgumentParser()
- subparsers = parser.add_subparsers(help="List of commands")
-
- for command, options in COMMANDS.iteritems():
- sub_parcer = subparsers.add_parser(command, help=options["help"])
-
- if options.has_key("arguments"):
- for argument, arg_options in options["arguments"].iteritems():
- sub_parcer.add_argument(argument, **arg_options)
-
- if options.has_key("flags"):
- for argument, arg_options in options["flags"].iteritems():
- sub_parcer.add_argument(argument, **arg_options)
-
- ARGS = dict(parser.parse_args()._get_kwargs())
- ARGS = tools.strip(ARGS)
- logging.debug("CLI options: %s", str(ARGS))
-
- if COMAND == 'create':
- Notes().create(**ARGS)
-
- if COMAND == 'edit':
- Notes().edit(**ARGS)
-
- if COMAND == 'remove':
- Notes().remove(**ARGS)
-
- if COMAND == 'find':
- Notes().find(**ARGS)
+# -*- coding: utf-8 -*-
+# add Evernote SDK
+import os, sys
+PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
+EVERNOTE_SDK = os.path.join(PROJECT_ROOT, 'lib')
+sys.path.append( EVERNOTE_SDK )
+
+import sys
+import hashlib
+import binascii
+import time
+import thrift.protocol.TBinaryProtocol as TBinaryProtocol
+import thrift.transport.THttpClient as THttpClient
+import evernote.edam.userstore.UserStore as UserStore
+import evernote.edam.userstore.constants as UserStoreConstants
+import evernote.edam.notestore.NoteStore as NoteStore
+import evernote.edam.type.ttypes as Types
+import evernote.edam.error.ttypes as Errors
+import argparse
+import locale
+import time
+
+import io
+from oauth import GeekNoteAuth
+from storage import Storage
+import editor
+import tools
+from log import logging
+
+CONSUMER_KEY = 'skaizer-1250'
+CONSUMER_SECRET = 'ed0fcc0c97c032a5'
+
+class GeekNote:
+
+ consumerKey = CONSUMER_KEY
+ consumerSecret = CONSUMER_SECRET
+ userStoreUri = "https://sandbox.evernote.com/edam/user"
+ authToken = None
+ #authToken = "S=s1:U=2265a:E=13ee295740c:C=1378ae4480c:P=185:A=stepler-8439:H=8bfb5c7a5bd5517eb885034cf5d515b2"
+ userStore = None
+ noteStore = None
+ storage = None
+
+ def __init__(self):
+ self.getStorage()
+ self.checkVersion()
+
+ #io.preloader.setMessage('Check OAuth Token..')
+ self.checkAuth()
+
+ def getStorage(self):
+ if self.storage:
+ return self.storage
+
+ self.storage = Storage()
+ return self.storage
+
+ def setUserStore(self, store):
+ self.userStore = store
+
+
+ def getUserStore(self):
+ if self.userStore:
+ return self.userStore
+
+ logging.error("User Store not exist")
+
+ def loadNoteStore(self):
+ noteStoreUrl = self.getUserStore().getNoteStoreUrl(self.authToken)
+ noteStoreHttpClient = THttpClient.THttpClient(noteStoreUrl)
+ noteStoreProtocol = TBinaryProtocol.TBinaryProtocol(noteStoreHttpClient)
+ self.noteStore = NoteStore.Client(noteStoreProtocol)
+
+ def getNoteStore(self):
+ if self.noteStore:
+ return self.noteStore
+
+ self.loadNoteStore()
+ return self.noteStore
+
+ def checkVersion(self):
+ userStoreHttpClient = THttpClient.THttpClient(self.userStoreUri)
+ userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient)
+ self.setUserStore(UserStore.Client(userStoreProtocol))
+
+ versionOK = self.getUserStore().checkVersion("Python EDAMTest",
+ UserStoreConstants.EDAM_VERSION_MAJOR,
+ UserStoreConstants.EDAM_VERSION_MINOR)
+ if not versionOK:
+ logging.error("Old EDAM version")
+ exit(1)
+
+ def checkAuth(self):
+ self.authToken = self.getStorage().getUserToken()
+ logging.debug("oAuth token : %s", self.authToken)
+ if self.authToken:
+ return
+
+ GNA = GeekNoteAuth()
+ self.authToken = GNA.getToken()
+ userInfo = self.getUserInfo()
+ if not isinstance(userInfo, Types.User):
+ logging.error("User info not get")
+
+ self.getStorage().createUser(self.authToken, userInfo)
+
+ def getUserInfo(self):
+ return self.getUserStore().getUser(self.authToken)
+
+ def findNotes(self, keywords, count):
+ nf = NoteStore.NoteFilter()
+ if keywords:
+ nf.words = keywords
+ return self.getNoteStore().findNotes(self.authToken, nf, 0, count)
+
+ def loadNoteContent(self, note):
+ """ modify Note object """
+ if not isinstance(note, Types.Note):
+ raise Exception("Note content must be an instanse of Note, '%s' given." % type(content))
+
+ note.content = self.getNoteStore().getNoteContent(self.authToken, note.guid)
+
+ def createNote(self, title, content, tags=None, notebook=None):
+ note = Types.Note()
+ note.title = title
+ note.content = content
+
+ if tags:
+ note.tagNames = tags
+
+ if notebook:
+ note.notebookGuid = notebook
+
+ logging.debug("New note : %s", note)
+
+ try:
+ self.getNoteStore().createNote(self.authToken, note)
+ return True
+ except Exception, e:
+ logging.error("Error: %s", str(e))
+ return False
+
+ def updateNote(self, guid, title=None, content=None, tags=None, notebook=None):
+ note = Types.Note()
+ note.guid = guid
+ if title:
+ note.title = title
+
+ if content:
+ note.content = content
+
+ if tags:
+ note.tagNames = tags
+
+ if notebook:
+ note.notebookGuid = notebook
+
+ logging.debug("Update note : %s", note)
+
+ try:
+ self.getNoteStore().updateNote(self.authToken, note)
+ return True
+ except Exception, e:
+ logging.error("Error: %s", str(e))
+ return False
+
+ def deleteNote(self, guid):
+ logging.debug("Delete note with guid: %s", guid)
+ try:
+ self.getNoteStore().deleteNote(self.authToken, guid)
+ return True
+ except Exception, e:
+ logging.error("Error: %s", str(e))
+ return False
+
+
+class GeekNoteConnector(object):
+ evernote = None
+ storage = None
+
+ def connectToEvertone(self):
+ if self.evernote:
+ return
+
+ io.preloader.setMessage("Connect to Evernote...")
+ self.evernote = GeekNote()
+
+ def getEvernote(self):
+ if self.evernote:
+ return self.evernote
+
+ self.connectToEvertone()
+ return self.evernote
+
+ def getStorage(self):
+ if self.storage:
+ return self.storage
+
+ self.storage = self.getEvernote().getStorage()
+ return self.storage
+
+
+class User(GeekNoteConnector):
+ """ Work with auth User """
+
+ def info(self, full=True):
+
+ info = self.getEvernote().getUserInfo()
+ #logging.debug("User info:" % str(info))
+ io.showUser(info, True)
+
+
+class Notes(GeekNoteConnector):
+ """ Work with Notes """
+
+ def create(self, title, body, tags=None, notepad=None):
+
+ if body == "WRITE_IN_EDITOR":
+ logging.debug("launch system editor")
+ body = editor.edit()
+
+ else:
+ logging.debug("Convert body")
+ body = editor.textToENML(body)
+
+ if tags:
+ tags = tools.strip(tags.split(','))
+
+ if notepad:
+ # TODO search notebooks in storage
+ logging.debug("search notebook")
+
+ self.connectToEvertone()
+ io.preloader.setMessage("Creating note...")
+ result = self.getEvernote().createNote(title=title, content=body, tags=tags, notebook=notepad)
+
+ if result:
+ io.successMessage("Note successfully created")
+ else:
+ io.failureMessage("Error while creating the note")
+
+ def edit(self, note, title=None, body=None, tags=None, notepad=None):
+
+ self.connectToEvertone()
+ note = self._searchNote(note)
+
+ if not title:
+ title = note.title
+
+ if body:
+ if body == "WRITE_IN_EDITOR":
+ logging.debug("launch system editor")
+ self.getEvernote().loadNoteContent(note)
+ body = editor.edit(note.content)
+
+ else:
+ logging.debug("Convert body")
+ body = editor.textToENML(body)
+
+ if tags:
+ tags = tools.strip(tags.split(','))
+
+ if notepad:
+ # TODO search notebooks in storage
+ logging.debug("search notebook")
+
+
+ io.preloader.setMessage("Saving note...")
+ result = self.getEvernote().updateNote(guid=note.guid, title=title, content=body, tags=tags, notebook=notepad)
+
+ if result:
+ io.successMessage("Note successfully saved")
+ else:
+ io.failureMessage("Error while saving the note")
+
+ def remove(self, note):
+
+ self.connectToEvertone()
+ note = self._searchNote(note)
+
+ if not io.removeConfirm(note.title):
+ exit(1)
+
+ io.preloader.setMessage("Deleting note...")
+ result = self.getEvernote().deleteNote(note.guid)
+
+ if result:
+ io.successMessage("Note successful deleted")
+ else:
+ io.failureMessage("Error while deleting the note")
+
+ def show(self, note):
+
+ self.connectToEvertone()
+
+ note = self._searchNote(note)
+
+ io.preloader.setMessage("Loading note...")
+ self.getEvernote().loadNoteContent(note)
+
+ io.showNote(note)
+
+
+ def _searchNote(self, note):
+ note = tools.strip(note)
+ if tools.checkIsInt(note):
+ # TODO request in storage
+ # TMP >>>
+ result = self.getEvernote().findNotes(None, 1)
+ note = result.notes[0]
+ # TMP <<<
+
+ else:
+ request = "intitle:%s" % note if note else None
+ logging.debug("Search notes: %s" % request)
+ result = self.getEvernote().findNotes(request, 20)
+
+ logging.debug("Search notes result: %s" % str(result))
+ if result.totalNotes == 0:
+ io.successMessage("Notes not found")
+ exit(1)
+
+ elif result.totalNotes == 1:
+ note = result.notes[0]
+
+ else:
+ logging.debug("Choose notes: %s" % str(result.notes))
+ note = io.SelectSearchResult(result.notes)
+
+ logging.debug("Selected note: %s" % str(note))
+ return note
+
+
+ def find(self, search=None, tags=None, notepads=None, date=None, count=None, exact_entry=None, content_search=None, url_only=None, ):
+
+ request = ""
+ if search:
+ search = tools.strip(search)
+ if exact_entry:
+ search = '"%s"' % search
+
+ if content_search:
+ request += "any:%s " % search
+ else:
+ request += "intitle:%s " % search
+
+ if tags:
+ for tag in tools.strip(tags.split(',')):
+
+ if tag.startswith('-'):
+ request +="-tag:%s " % tag[1:]
+ else:
+ request +="tag:%s " % tag
+
+ if date:
+ date = tools.strip(date.split('-'))
+ try:
+ start_date = time.strptime(date[0], "%d.%m.%Y")
+ request +="created:%s " % time.strftime("%Y%m%d", start_date)
+
+ if len(date) == 2:
+ request += "-created:%s " % time.strftime("%Y%m%d", time.strptime(date[1], "%d.%m.%Y"))
+ else:
+ request += "-created:%s " % time.strftime("%Y%m%d", time.gmtime(time.mktime(start_date)+60*60*24*2))
+
+ except ValueError, e:
+ io.failureMessage('Incorrect date format in --date attribute. Format: %s' % time.strftime("%d.%m.%Y", time.strptime('19991231', "%Y%m%d")))
+ exit(1)
+
+ if notepads:
+ for notepad in tools.strip(notepads.split(',')):
+ if notepad.startswith('-'):
+ request += "-notebook:%s " % tools.strip(notepad[1:])
+ else:
+ request += "notebook:%s " % tools.strip(notepad)
+
+ if not count:
+ count = 20
+
+ logging.debug("Search request: %s", request)
+ logging.debug("Search count: %s", count)
+
+ result = self.getEvernote().findNotes(request, count)
+
+ if result.totalNotes == 0:
+ io.successMessage("Notes not found")
+
+ notes = dict( (index+1, {"title": item.title, "guid": item.guid}) for index, item in enumerate(result.notes) )
+ # TODO Save result to storage
+
+ # print results
+ io.SearchResult(notes, request)
+
+COMMANDS = {
+ "create": {
+ "help": "Create note",
+ "arguments": {
+ "--title": {"help": "Set note title", "required": True},
+ "--body": {"help": "Set note content", "required": True},
+ "--tags": {"help": "Add tag to note"},
+ "--notepad": {"help": "Add location marker to note"}
+ }
+ },
+ "edit": {
+ "help": "Create note",
+ "arguments": {
+ "--note": {"help": "Set note title"},
+ "--title": {"help": "Set note title"},
+ "--body": {"help": "Set note content"},
+ "--tags": {"help": "Add tag to note"},
+ "--notepad": {"help": "Add location marker to note"}
+ }
+ },
+ "remove": {
+ "help": "Create note",
+ "arguments": {
+ "--note": {"help": "Set note title"},
+ }
+ },
+ "show": {
+ "help": "Create note",
+ "arguments": {
+ "--note": {"help": "Set note title"},
+ }
+ },
+ "user": {
+ "help": "Create note",
+ "flags": {
+ "--full": {"help": "Add tag to note", "action": "store_true"},
+ }
+ },
+ "find": {
+ "help": "Create note",
+ "arguments": {
+ "--search": {"help": "Add tag to note"},
+ "--tags": {"help": "Add tag to note"},
+ "--notepads": {"help": "Add location marker to note"},
+ "--date": {"help": "Add location marker to note"},
+ "--count": {"help": "Add location marker to note"},
+ },
+ "flags": {
+ "--exact-entry": {"help": "Add tag to note", "action": "store_true"},
+ "--content-search": {"help": "Add tag to note", "action": "store_true"},
+ "--url-only": {"help": "Add tag to note"},
+ }
+ },
+}
+
+if __name__ == "__main__":
+
+ COMAND = sys.argv[1] if len(sys.argv) >= 2 else ""
+
+ # run check & run autocomplete
+ if COMAND == "autocomplete":
+ tools.printAutocomplete(COMMANDS, sys.argv[2:])
+ exit(1)
+
+ # create CLI parcer
+ parser = argparse.ArgumentParser()
+ subparsers = parser.add_subparsers(help="List of commands")
+
+ for command, options in COMMANDS.iteritems():
+ sub_parcer = subparsers.add_parser(command, help=options["help"])
+
+ if options.has_key("arguments"):
+ for argument, arg_options in options["arguments"].iteritems():
+ sub_parcer.add_argument(argument, **arg_options)
+
+ if options.has_key("flags"):
+ for argument, arg_options in options["flags"].iteritems():
+ sub_parcer.add_argument(argument, **arg_options)
+
+ ARGS = dict(parser.parse_args()._get_kwargs())
+ ARGS = tools.strip(ARGS)
+ logging.debug("CLI options: %s", str(ARGS))
+
+ if COMAND == 'create':
+ Notes().create(**ARGS)
+
+ if COMAND == 'edit':
+ Notes().edit(**ARGS)
+
+ if COMAND == 'remove':
+ Notes().remove(**ARGS)
+
+ if COMAND == 'show':
+ Notes().show(**ARGS)
+
+ if COMAND == 'find':
+ Notes().find(**ARGS)
+
+ if COMAND == 'user':
+ User().info(**ARGS)
View
370 io.py
@@ -1,169 +1,201 @@
-# -*- coding: utf-8 -*-
-import getpass
-import time
-import sys
-import thread
-import tools
-
-def preloaderPause(fn, *args, **kwargs):
- def wrapped(*args, **kwargs):
-
- if not preloader.isLaunch:
- return fn(*args, **kwargs)
-
- preloader.stop()
- result = fn(*args, **kwargs)
- preloader.launch()
-
- return result
-
- return wrapped
-
-def preloaderStop(fn, *args, **kwargs):
- def wrapped(*args, **kwargs):
-
- if not preloader.isLaunch:
- return fn(*args, **kwargs)
-
- preloader.stop()
- result = fn(*args, **kwargs)
- return result
-
- return wrapped
-
-
-class preloader(object):
-
- #progress = "\|/-"
- progress = ("> ", ">> ", ">>>", " >>", " >", " ")
- clearLine = "\r"+" "*40+"\r"
- message = None
- isLaunch = False
- counter = 0
-
- @staticmethod
- def setMessage(message, needLaunch=True):
- preloader.message = message
- if not preloader.isLaunch and needLaunch:
- preloader.launch()
-
- @staticmethod
- def launch():
- preloader.counter = 0
- preloader.isLaunch = True
- thread.start_new_thread(preloader.draw, ())
-
- @staticmethod
- def stop():
- preloader.counter = -1
- preloader.draw()
- preloader.isLaunch = False
-
- @staticmethod
- def draw():
- if not preloader.isLaunch:
- return
-
- sys.stdout.write(preloader.clearLine)
- if preloader.counter == -1:
- sys.stdout.flush()
- return
-
- preloader.counter += 1
- sys.stdout.write("%s : %s" % (preloader.progress[preloader.counter % len(preloader.progress)], preloader.message))
- sys.stdout.flush()
-
- time.sleep(0.3)
- preloader.draw()
-
-@preloaderPause
-def GetUserCredentials():
- """Prompts the user for a username and password."""
-
- email = None
- password = None
- if email is None:
- email = raw_input("Email: ")
-
- if password is None:
- password = getpass.getpass("Password for %s: " % email)
-
- return (email, password)
-
-@preloaderStop
-def SearchResult(result, request):
- """Печать результатов поиска"""
-
- request_row = "Search request: %s \n"
- result_total = "Total found: %d \n"
- result_row = "%(key)s: %(title)s \n"
-
- total = len(result)
- sys.stdout.write(request_row % request)
- sys.stdout.write(result_total % total)
- for key, item in result.iteritems():
- sys.stdout.write(result_row % {'key': str(key).rjust(3, " "), 'title': item['title']})
- if key%2 == 0 and key < total:
- sys.stdout.write("-- More -- \r")
- tools.getch()
- sys.stdout.write(" "*10 +"\r")
-
- sys.stdout.flush()
-
-@preloaderStop
-def SelectSearchResult(result):
- """Выбор результата поиска"""
-
- result_total = "Total found: %d \n"
- result_row = "%(key)s: %(title)s \n"
-
- total = len(result)
- sys.stdout.write(result_total % total)
-
- for key, item in result.iteritems():
- sys.stdout.write(result_row % {'key': str(key).rjust(3, " "), 'title': item['title']})
- """
- if key%2 == 0 and key < total:
- sys.stdout.write("-- More -- \r")
- tools.getch()
- sys.stdout.write(" "*10 +"\r")
- """
-
- sys.stdout.flush()
-
- while True:
- num = raw_input(": ")
- if tools.checkIsInt(num) and 1 <= int(num) <= total:
- return result[int(num)]
-
- failureMessage('Incorrect number "%s", please try again:\n' % num)
-
-@preloaderStop
-def removeConfirm(title):
- """Подтверждение удаления заметки"""
-
- sys.stdout.write('Are you sure you want to delete this note: "%s"\n' % title)
- sys.stdout.flush()
-
- while True:
- answer = raw_input("Yes/No: ")
-
- if answer.lower() in ["yes", "ye", "y"]:
- return True
-
- if answer.lower() in ["no", "n"]:
- return False
-
- failureMessage('Incorrect answer "%s", please try again:\n' % answer)
-
-@preloaderStop
-def successMessage(message):
- """ Вывод сообщения """
- sys.stdout.write(message)
- sys.stdout.flush()
-
-@preloaderStop
-def failureMessage(message):
- """ Вывод сообщения """
- sys.stdout.write(message)
- sys.stdout.flush()
+# -*- coding: utf-8 -*-
+import getpass
+import time
+import sys
+import thread
+import tools
+import editor
+
+def preloaderPause(fn, *args, **kwargs):
+ def wrapped(*args, **kwargs):
+
+ if not preloader.isLaunch:
+ return fn(*args, **kwargs)
+
+ preloader.stop()
+ result = fn(*args, **kwargs)
+ preloader.launch()
+
+ return result
+
+ return wrapped
+
+def preloaderStop(fn, *args, **kwargs):
+ def wrapped(*args, **kwargs):
+
+ if not preloader.isLaunch:
+ return fn(*args, **kwargs)
+
+ preloader.stop()
+ result = fn(*args, **kwargs)
+ return result
+
+ return wrapped
+
+
+class preloader(object):
+
+ #progress = "\|/-"
+ progress = ("> ", ">> ", ">>>", " >>", " >", " ")
+ clearLine = "\r"+" "*40+"\r"
+ message = None
+ isLaunch = False
+ counter = 0
+
+ @staticmethod
+ def setMessage(message, needLaunch=True):
+ preloader.message = message
+ if not preloader.isLaunch and needLaunch:
+ preloader.launch()
+
+ @staticmethod
+ def launch():
+ preloader.counter = 0
+ preloader.isLaunch = True
+ thread.start_new_thread(preloader.draw, ())
+
+ @staticmethod
+ def stop():
+ preloader.counter = -1
+ preloader.draw()
+ preloader.isLaunch = False
+
+ @staticmethod
+ def draw():
+ if not preloader.isLaunch:
+ return
+
+ sys.stdout.write(preloader.clearLine)
+ if preloader.counter == -1:
+ sys.stdout.flush()
+ return
+
+ preloader.counter += 1
+ sys.stdout.write("%s : %s" % (preloader.progress[preloader.counter % len(preloader.progress)], preloader.message))
+ sys.stdout.flush()
+
+ time.sleep(0.3)
+ preloader.draw()
+
+@preloaderPause
+def GetUserCredentials():
+ """Prompts the user for a username and password."""
+
+ email = None
+ password = None
+ if email is None:
+ email = raw_input("Email: ")
+
+ if password is None:
+ password = getpass.getpass("Password for %s: " % email)
+
+ return (email, password)
+
+@preloaderStop
+def SearchResult(result, request):
+ """Печать результатов поиска"""
+
+ request_row = "Search request: %s \n"
+ result_total = "Total found: %d \n"
+ result_row = "%(key)s: %(title)s \n"
+
+ total = len(result)
+ sys.stdout.write(request_row % request)
+ sys.stdout.write(result_total % total)
+ for key, item in result.iteritems():
+ sys.stdout.write(result_row % {'key': str(key).rjust(3, " "), 'title': item['title']})
+ if key%2 == 0 and key < total:
+ sys.stdout.write("-- More -- \r")
+ tools.getch()
+ sys.stdout.write(" "*10 +"\r")
+
+ sys.stdout.flush()
+
+@preloaderStop
+def SelectSearchResult(listItems):
+ """Выбор результата поиска"""
+
+ total = len(listItems)
+
+ separator("#", "FOUND NOTES")
+ sys.stdout.write("Total found: %d \n" % total)
+
+ for key, item in enumerate(listItems):
+ sys.stdout.write("%(key)s: %(title)s \n" % {'key': str(key+1).rjust(3, " "), 'title': item.title})
+
+ sys.stdout.flush()
+
+ while True:
+ num = raw_input(": ")
+ if tools.checkIsInt(num) and 1 <= int(num) <= total:
+ return listItems[int(num)-1]
+
+ failureMessage('Incorrect number "%s", please try again:\n' % num)
+
+@preloaderStop
+def removeConfirm(title):
+ """Подтверждение удаления заметки"""
+
+ sys.stdout.write('Are you sure you want to delete this note: "%s"\n' % title)
+ sys.stdout.flush()
+
+ while True:
+ answer = raw_input("Yes/No: ")
+
+ if answer.lower() in ["yes", "ye", "y"]:
+ return True
+
+ if answer.lower() in ["no", "n"]:
+ return False
+
+ failureMessage('Incorrect answer "%s", please try again:\n' % answer)
+
+@preloaderStop
+def showNote(note):
+
+ separator("#")
+ sys.stdout.write("TITLE: %s\n" % note.title)
+ separator("=")
+ if note.tagNames:
+ sys.stdout.write("Tags: %s\n" % ', '.join(note.tagNames))
+
+ sys.stdout.write(editor.ENMLtoText(note.content))
+ sys.stdout.flush()
+
+@preloaderStop
+def showUser(user, fullInfo):
+ def line(key, value):
+ if value:
+ sys.stdout.write("%s : %s \n" % (key.ljust(16, " "), value))
+
+ separator("#", "USER INFO")
+ line('Username', user.username)
+ line('Name', user.name)
+ line('eEail', user.email)
+
+ if fullInfo:
+ line('Upload limit', "%.2f" % (int(user.accounting.uploadLimit) / 1024 / 1024))
+ line('Upload limit end', time.strftime("%d.%m.%Y", time.gmtime(user.accounting.uploadLimitEnd / 1000 )) )
+ sys.stdout.flush()
+
+@preloaderStop
+def successMessage(message):
+ """ Вывод сообщения """
+ sys.stdout.write(message+"\n")
+ sys.stdout.flush()
+
+@preloaderStop
+def failureMessage(message):
+ """ Вывод сообщения """
+ sys.stdout.write(message+"\n")
+ sys.stdout.flush()
+
+def separator(symbol="", title=""):
+
+ size = 40
+ if title:
+ sw = (size - len(title) + 2) / 2
+ sys.stdout.write("%s %s %s \n" % (symbol*sw, title, symbol*sw))
+
+ else:
+ sys.stdout.write(symbol*size+"\n")
View
2 lib/evernote/edam/error/__init__.py
@@ -1 +1 @@
-__all__ = ['ttypes', 'constants']
+__all__ = ['ttypes', 'constants']
View
22 lib/evernote/edam/error/constants.py
@@ -1,11 +1,11 @@
-#
-# Autogenerated by Thrift Compiler (0.8.0)
-#
-# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
-#
-# options string: py:new_style
-#
-
-from thrift.Thrift import TType, TMessageType, TException
-from ttypes import *
-
+#
+# Autogenerated by Thrift Compiler (0.8.0)
+#
+# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+#
+# options string: py:new_style
+#
+
+from thrift.Thrift import TType, TMessageType, TException
+from ttypes import *
+
View
768 lib/evernote/edam/error/ttypes.py
@@ -1,384 +1,384 @@
-#
-# Autogenerated by Thrift Compiler (0.8.0)
-#
-# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
-#
-# options string: py:new_style
-#
-
-from thrift.Thrift import TType, TMessageType, TException
-
-from thrift.transport import TTransport
-from thrift.protocol import TBinaryProtocol, TProtocol
-try:
- from thrift.protocol import fastbinary
-except:
- fastbinary = None
-
-
-class EDAMErrorCode(object):
- """
- Numeric codes indicating the type of error that occurred on the
- service.
- <dl>
- <dt>UNKNOWN</dt
- <dd>No information available about the error</dd>
- <dt>BAD_DATA_FORMAT</dt>
- <dd>The format of the request data was incorrect</dd>
- <dt>PERMISSION_DENIED</dt>
- <dd>Not permitted to perform action</dd>
- <dt>INTERNAL_ERROR</dt>
- <dd>Unexpected problem with the service</dd>
- <dt>DATA_REQUIRED</dt>
- <dd>A required parameter/field was absent</dd>
- <dt>LIMIT_REACHED</dt>
- <dd>Operation denied due to data model limit</dd>
- <dt>QUOTA_REACHED</dt>
- <dd>Operation denied due to user storage limit</dd>
- <dt>INVALID_AUTH</dt>
- <dd>Username and/or password incorrect</dd>
- <dt>AUTH_EXPIRED</dt>
- <dd>Authentication token expired</dd>
- <dt>DATA_CONFLICT</dt>
- <dd>Change denied due to data model conflict</dd>
- <dt>ENML_VALIDATION</dt>
- <dd>Content of submitted note was malformed</dd>
- <dt>SHARD_UNAVAILABLE</dt>
- <dd>Service shard with account data is temporarily down</dd>
- <dt>LEN_TOO_SHORT</dt>
- <dd>Operation denied due to data model limit, where something such
- as a string length was too short</dd>
- <dt>LEN_TOO_LONG</dt>
- <dd>Operation denied due to data model limit, where something such
- as a string length was too long</dd>
- <dt>TOO_FEW</dt>
- <dd>Operation denied due to data model limit, where there were
- too few of something.</dd>
- <dt>TOO_MANY</dt>
- <dd>Operation denied due to data model limit, where there were
- too many of something.</dd>
- <dt>UNSUPPORTED_OPERATION</dt>
- <dd>Operation denied because it is currently unsupported.</dd>
- </dl>
- """
- UNKNOWN = 1
- BAD_DATA_FORMAT = 2
- PERMISSION_DENIED = 3
- INTERNAL_ERROR = 4
- DATA_REQUIRED = 5
- LIMIT_REACHED = 6
- QUOTA_REACHED = 7
- INVALID_AUTH = 8
- AUTH_EXPIRED = 9
- DATA_CONFLICT = 10
- ENML_VALIDATION = 11
- SHARD_UNAVAILABLE = 12
- LEN_TOO_SHORT = 13
- LEN_TOO_LONG = 14
- TOO_FEW = 15
- TOO_MANY = 16
- UNSUPPORTED_OPERATION = 17
-
- _VALUES_TO_NAMES = {
- 1: "UNKNOWN",
- 2: "BAD_DATA_FORMAT",
- 3: "PERMISSION_DENIED",
- 4: "INTERNAL_ERROR",
- 5: "DATA_REQUIRED",
- 6: "LIMIT_REACHED",
- 7: "QUOTA_REACHED",
- 8: "INVALID_AUTH",
- 9: "AUTH_EXPIRED",
- 10: "DATA_CONFLICT",
- 11: "ENML_VALIDATION",
- 12: "SHARD_UNAVAILABLE",
- 13: "LEN_TOO_SHORT",
- 14: "LEN_TOO_LONG",
- 15: "TOO_FEW",
- 16: "TOO_MANY",
- 17: "UNSUPPORTED_OPERATION",
- }
-
- _NAMES_TO_VALUES = {
- "UNKNOWN": 1,
- "BAD_DATA_FORMAT": 2,
- "PERMISSION_DENIED": 3,
- "INTERNAL_ERROR": 4,
- "DATA_REQUIRED": 5,
- "LIMIT_REACHED": 6,
- "QUOTA_REACHED": 7,
- "INVALID_AUTH": 8,
- "AUTH_EXPIRED": 9,
- "DATA_CONFLICT": 10,
- "ENML_VALIDATION": 11,
- "SHARD_UNAVAILABLE": 12,
- "LEN_TOO_SHORT": 13,
- "LEN_TOO_LONG": 14,
- "TOO_FEW": 15,
- "TOO_MANY": 16,
- "UNSUPPORTED_OPERATION": 17,
- }
-
-
-class EDAMUserException(TException):
- """
- This exception is thrown by EDAM procedures when a call fails as a result of
- a problem that a user may be able to resolve. For example, if the user
- attempts to add a note to their account which would exceed their storage
- quota, this type of exception may be thrown to indicate the source of the
- error so that they can choose an alternate action.
-
- This exception would not be used for internal system errors that do not
- reflect user actions, but rather reflect a problem within the service that
- the user cannot resolve.
-
- errorCode: The numeric code indicating the type of error that occurred.
- must be one of the values of EDAMErrorCode.
-
- parameter: If the error applied to a particular input parameter, this will
- indicate which parameter.
-
- Attributes:
- - errorCode
- - parameter
- """
-
- thrift_spec = (
- None, # 0
- (1, TType.I32, 'errorCode', None, None, ), # 1
- (2, TType.STRING, 'parameter', None, None, ), # 2
- )
-
- def __init__(self, errorCode=None, parameter=None,):
- self.errorCode = errorCode
- self.parameter = parameter
-
- def read(self, iprot):
- if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
- fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
- return
- iprot.readStructBegin()
- while True:
- (fname, ftype, fid) = iprot.readFieldBegin()
- if ftype == TType.STOP:
- break
- if fid == 1:
- if ftype == TType.I32:
- self.errorCode = iprot.readI32();
- else:
- iprot.skip(ftype)
- elif fid == 2:
- if ftype == TType.STRING:
- self.parameter = iprot.readString();
- else:
- iprot.skip(ftype)
- else:
- iprot.skip(ftype)
- iprot.readFieldEnd()
- iprot.readStructEnd()
-
- def write(self, oprot):
- if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
- oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
- return
- oprot.writeStructBegin('EDAMUserException')
- if self.errorCode is not None:
- oprot.writeFieldBegin('errorCode', TType.I32, 1)
- oprot.writeI32(self.errorCode)
- oprot.writeFieldEnd()
- if self.parameter is not None:
- oprot.writeFieldBegin('parameter', TType.STRING, 2)
- oprot.writeString(self.parameter)
- oprot.writeFieldEnd()
- oprot.writeFieldStop()
- oprot.writeStructEnd()
-
- def validate(self):
- if self.errorCode is None:
- raise TProtocol.TProtocolException(message='Required field errorCode is unset!')
- return
-
-
- def __str__(self):
- return repr(self)
-
- def __repr__(self):
- L = ['%s=%r' % (key, value)
- for key, value in self.__dict__.iteritems()]
- return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
- def __eq__(self, other):
- return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
- def __ne__(self, other):
- return not (self == other)
-
-class EDAMSystemException(TException):
- """
- This exception is thrown by EDAM procedures when a call fails as a result of
- an a problem in the service that could not be changed through user action.
-
- errorCode: The numeric code indicating the type of error that occurred.
- must be one of the values of EDAMErrorCode.
-
- message: This may contain additional information about the error
-
- Attributes:
- - errorCode
- - message
- """
-
- thrift_spec = (
- None, # 0
- (1, TType.I32, 'errorCode', None, None, ), # 1
- (2, TType.STRING, 'message', None, None, ), # 2
- )
-
- def __init__(self, errorCode=None, message=None,):
- self.errorCode = errorCode
- self.message = message
-
- def read(self, iprot):
- if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
- fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
- return
- iprot.readStructBegin()
- while True:
- (fname, ftype, fid) = iprot.readFieldBegin()
- if ftype == TType.STOP:
- break
- if fid == 1:
- if ftype == TType.I32:
- self.errorCode = iprot.readI32();
- else:
- iprot.skip(ftype)
- elif fid == 2:
- if ftype == TType.STRING:
- self.message = iprot.readString();
- else:
- iprot.skip(ftype)
- else:
- iprot.skip(ftype)
- iprot.readFieldEnd()
- iprot.readStructEnd()
-
- def write(self, oprot):
- if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
- oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
- return
- oprot.writeStructBegin('EDAMSystemException')
- if self.errorCode is not None:
- oprot.writeFieldBegin('errorCode', TType.I32, 1)
- oprot.writeI32(self.errorCode)
- oprot.writeFieldEnd()
- if self.message is not None:
- oprot.writeFieldBegin('message', TType.STRING, 2)
- oprot.writeString(self.message)
- oprot.writeFieldEnd()
- oprot.writeFieldStop()
- oprot.writeStructEnd()
-
- def validate(self):
- if self.errorCode is None:
- raise TProtocol.TProtocolException(message='Required field errorCode is unset!')
- return
-
-
- def __str__(self):
- return repr(self)
-
- def __repr__(self):
- L = ['%s=%r' % (key, value)
- for key, value in self.__dict__.iteritems()]
- return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
- def __eq__(self, other):
- return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
- def __ne__(self, other):
- return not (self == other)
-
-class EDAMNotFoundException(TException):
- """
- This exception is thrown by EDAM procedures when a caller asks to perform
- an operation that does not exist. This may be thrown based on an invalid
- primary identifier (e.g. a bad GUID), or when the caller refers to an object
- by another unique identifier (e.g. a User's email address).
-
- identifier: the object identifier that was not found on the server.
-
- key: the value passed from the client in the identifier, which was not
- found. E.g. the GUID of an object that was not found.
-
- Attributes:
- - identifier
- - key
- """
-
- thrift_spec = (
- None, # 0
- (1, TType.STRING, 'identifier', None, None, ), # 1
- (2, TType.STRING, 'key', None, None, ), # 2
- )
-
- def __init__(self, identifier=None, key=None,):
- self.identifier = identifier
- self.key = key
-
- def read(self, iprot):
- if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
- fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
- return
- iprot.readStructBegin()
- while True:
- (fname, ftype, fid) = iprot.readFieldBegin()
- if ftype == TType.STOP:
- break
- if fid == 1:
- if ftype == TType.STRING:
- self.identifier = iprot.readString();
- else:
- iprot.skip(ftype)
- elif fid == 2:
- if ftype == TType.STRING:
- self.key = iprot.readString();
- else:
- iprot.skip(ftype)
- else:
- iprot.skip(ftype)
- iprot.readFieldEnd()
- iprot.readStructEnd()
-
- def write(self, oprot):
- if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
- oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
- return
- oprot.writeStructBegin('EDAMNotFoundException')
- if self.identifier is not None:
- oprot.writeFieldBegin('identifier', TType.STRING, 1)
- oprot.writeString(self.identifier)
- oprot.writeFieldEnd()
- if self.key is not None:
- oprot.writeFieldBegin('key', TType.STRING, 2)
- oprot.writeString(self.key)
- oprot.writeFieldEnd()
- oprot.writeFieldStop()
- oprot.writeStructEnd()
-
- def validate(self):
- return
-
-
- def __str__(self):
- return repr(self)
-
- def __repr__(self):
- L = ['%s=%r' % (key, value)
- for key, value in self.__dict__.iteritems()]
- return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
- def __eq__(self, other):
- return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
- def __ne__(self, other):
- return not (self == other)
+#
+# Autogenerated by Thrift Compiler (0.8.0)
+#
+# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+#
+# options string: py:new_style
+#
+
+from thrift.Thrift import TType, TMessageType, TException
+
+from thrift.transport import TTransport
+from thrift.protocol import TBinaryProtocol, TProtocol
+try:
+ from thrift.protocol import fastbinary
+except:
+ fastbinary = None
+
+
+class EDAMErrorCode(object):
+ """
+ Numeric codes indicating the type of error that occurred on the
+ service.
+ <dl>
+ <dt>UNKNOWN</dt
+ <dd>No information available about the error</dd>
+ <dt>BAD_DATA_FORMAT</dt>
+ <dd>The format of the request data was incorrect</dd>
+ <dt>PERMISSION_DENIED</dt>
+ <dd>Not permitted to perform action</dd>
+ <dt>INTERNAL_ERROR</dt>
+ <dd>Unexpected problem with the service</dd>
+ <dt>DATA_REQUIRED</dt>
+ <dd>A required parameter/field was absent</dd>
+ <dt>LIMIT_REACHED</dt>
+ <dd>Operation denied due to data model limit</dd>
+ <dt>QUOTA_REACHED</dt>
+ <dd>Operation denied due to user storage limit</dd>
+ <dt>INVALID_AUTH</dt>
+ <dd>Username and/or password incorrect</dd>
+ <dt>AUTH_EXPIRED</dt>
+ <dd>Authentication token expired</dd>
+ <dt>DATA_CONFLICT</dt>
+ <dd>Change denied due to data model conflict</dd>
+ <dt>ENML_VALIDATION</dt>
+ <dd>Content of submitted note was malformed</dd>
+ <dt>SHARD_UNAVAILABLE</dt>
+ <dd>Service shard with account data is temporarily down</dd>
+ <dt>LEN_TOO_SHORT</dt>
+ <dd>Operation denied due to data model limit, where something such
+ as a string length was too short</dd>
+ <dt>LEN_TOO_LONG</dt>
+ <dd>Operation denied due to data model limit, where something such
+ as a string length was too long</dd>
+ <dt>TOO_FEW</dt>
+ <dd>Operation denied due to data model limit, where there were
+ too few of something.</dd>
+ <dt>TOO_MANY</dt>
+ <dd>Operation denied due to data model limit, where there were
+ too many of something.</dd>
+ <dt>UNSUPPORTED_OPERATION</dt>
+ <dd>Operation denied because it is currently unsupported.</dd>
+ </dl>
+ """
+ UNKNOWN = 1
+ BAD_DATA_FORMAT = 2
+ PERMISSION_DENIED = 3
+ INTERNAL_ERROR = 4
+ DATA_REQUIRED = 5
+ LIMIT_REACHED = 6
+ QUOTA_REACHED = 7
+ INVALID_AUTH = 8
+ AUTH_EXPIRED = 9
+ DATA_CONFLICT = 10
+ ENML_VALIDATION = 11
+ SHARD_UNAVAILABLE = 12
+ LEN_TOO_SHORT = 13
+ LEN_TOO_LONG = 14
+ TOO_FEW = 15
+ TOO_MANY = 16
+ UNSUPPORTED_OPERATION = 17
+
+ _VALUES_TO_NAMES = {
+ 1: "UNKNOWN",
+ 2: "BAD_DATA_FORMAT",
+ 3: "PERMISSION_DENIED",
+ 4: "INTERNAL_ERROR",
+ 5: "DATA_REQUIRED",
+ 6: "LIMIT_REACHED",
+ 7: "QUOTA_REACHED",
+ 8: "INVALID_AUTH",
+ 9: "AUTH_EXPIRED",
+ 10: "DATA_CONFLICT",
+ 11: "ENML_VALIDATION",
+ 12: "SHARD_UNAVAILABLE",
+ 13: "LEN_TOO_SHORT",
+ 14: "LEN_TOO_LONG",
+ 15: "TOO_FEW",
+ 16: "TOO_MANY",
+ 17: "UNSUPPORTED_OPERATION",
+ }
+
+ _NAMES_TO_VALUES = {
+ "UNKNOWN": 1,
+ "BAD_DATA_FORMAT": 2,
+ "PERMISSION_DENIED": 3,
+ "INTERNAL_ERROR": 4,
+ "DATA_REQUIRED": 5,
+ "LIMIT_REACHED": 6,
+ "QUOTA_REACHED": 7,
+ "INVALID_AUTH": 8,
+ "AUTH_EXPIRED": 9,
+ "DATA_CONFLICT": 10,
+ "ENML_VALIDATION": 11,
+ "SHARD_UNAVAILABLE": 12,
+ "LEN_TOO_SHORT": 13,
+ "LEN_TOO_LONG": 14,
+ "TOO_FEW": 15,
+ "TOO_MANY": 16,
+ "UNSUPPORTED_OPERATION": 17,
+ }
+
+
+class EDAMUserException(TException):
+ """
+ This exception is thrown by EDAM procedures when a call fails as a result of
+ a problem that a user may be able to resolve. For example, if the user
+ attempts to add a note to their account which would exceed their storage
+ quota, this type of exception may be thrown to indicate the source of the
+ error so that they can choose an alternate action.
+
+ This exception would not be used for internal system errors that do not
+ reflect user actions, but rather reflect a problem within the service that
+ the user cannot resolve.
+
+ errorCode: The numeric code indicating the type of error that occurred.
+ must be one of the values of EDAMErrorCode.
+
+ parameter: If the error applied to a particular input parameter, this will
+ indicate which parameter.
+
+ Attributes:
+ - errorCode
+ - parameter
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.I32, 'errorCode', None, None, ), # 1
+ (2, TType.STRING, 'parameter', None, None, ), # 2
+ )
+
+ def __init__(self, errorCode=None, parameter=None,):
+ self.errorCode = errorCode
+ self.parameter = parameter
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.I32:
+ self.errorCode = iprot.readI32();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.parameter = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('EDAMUserException')
+ if self.errorCode is not None:
+ oprot.writeFieldBegin('errorCode', TType.I32, 1)
+ oprot.writeI32(self.errorCode)
+ oprot.writeFieldEnd()
+ if self.parameter is not None:
+ oprot.writeFieldBegin('parameter', TType.STRING, 2)
+ oprot.writeString(self.parameter)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ if self.errorCode is None:
+ raise TProtocol.TProtocolException(message='Required field errorCode is unset!')
+ return
+
+
+ def __str__(self):
+ return repr(self)
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class EDAMSystemException(TException):
+ """
+ This exception is thrown by EDAM procedures when a call fails as a result of
+ an a problem in the service that could not be changed through user action.
+
+ errorCode: The numeric code indicating the type of error that occurred.
+ must be one of the values of EDAMErrorCode.
+
+ message: This may contain additional information about the error
+
+ Attributes:
+ - errorCode
+ - message
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.I32, 'errorCode', None, None, ), # 1
+ (2, TType.STRING, 'message', None, None, ), # 2
+ )
+
+ def __init__(self, errorCode=None, message=None,):
+ self.errorCode = errorCode
+ self.message = message
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.I32:
+ self.errorCode = iprot.readI32();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.message = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('EDAMSystemException')
+ if self.errorCode is not None:
+ oprot.writeFieldBegin('errorCode', TType.I32, 1)
+ oprot.writeI32(self.errorCode)
+ oprot.writeFieldEnd()
+ if self.message is not None:
+ oprot.writeFieldBegin('message', TType.STRING, 2)
+ oprot.writeString(self.message)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ if self.errorCode is None:
+ raise TProtocol.TProtocolException(message='Required field errorCode is unset!')
+ return
+
+
+ def __str__(self):
+ return repr(self)
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class EDAMNotFoundException(TException):
+ """
+ This exception is thrown by EDAM procedures when a caller asks to perform
+ an operation that does not exist. This may be thrown based on an invalid
+ primary identifier (e.g. a bad GUID), or when the caller refers to an object
+ by another unique identifier (e.g. a User's email address).
+
+ identifier: the object identifier that was not found on the server.
+
+ key: the value passed from the client in the identifier, which was not
+ found. E.g. the GUID of an object that was not found.
+
+ Attributes:
+ - identifier
+ - key
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'identifier', None, None, ), # 1
+ (2, TType.STRING, 'key', None, None, ), # 2
+ )
+
+ def __init__(self, identifier=None, key=None,):
+ self.identifier = identifier
+ self.key = key
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.STRING:
+ self.identifier = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.key = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('EDAMNotFoundException')
+ if self.identifier is not None:
+ oprot.writeFieldBegin('identifier', TType.STRING, 1)