├── lib
├── __init__.py
└── evernote
│ ├── __init__.py
│ ├── api
│ ├── __init__.py
│ └── client.py
│ └── edam
│ ├── __init__.py
│ ├── error
│ ├── __init__.py
│ ├── constants.py
│ └── ttypes.py
│ ├── type
│ ├── __init__.py
│ └── constants.py
│ ├── limits
│ ├── __init__.py
│ ├── ttypes.py
│ └── constants.py
│ ├── notestore
│ ├── __init__.py
│ ├── constants.py
│ └── NoteStore-remote
│ └── userstore
│ ├── __init__.py
│ ├── constants.py
│ ├── UserStore-remote
│ └── ttypes.py
├── MANIFEST.in
├── sample
├── django
│ ├── oauth
│ │ ├── __init__.py
│ │ ├── models.py
│ │ ├── config.py.template
│ │ ├── tests.py
│ │ └── views.py
│ ├── evernote_oauth_sample
│ │ ├── __init__.py
│ │ ├── urls.py
│ │ ├── templates
│ │ │ ├── oauth
│ │ │ │ ├── index.html
│ │ │ │ └── callback.html
│ │ │ └── base.html
│ │ ├── wsgi.py
│ │ └── settings.py
│ ├── .gitignore
│ ├── requirements.txt
│ └── manage.py
├── client
│ ├── enlogo.png
│ └── EDAMTest.py
└── pyramid
│ ├── evernote_oauth_sample
│ ├── static
│ │ ├── favicon.ico
│ │ ├── footerbg.png
│ │ ├── headerbg.png
│ │ ├── middlebg.png
│ │ ├── pyramid.png
│ │ ├── transparent.gif
│ │ ├── pyramid-small.png
│ │ ├── ie6.css
│ │ └── pylons.css
│ ├── templates
│ │ ├── home.mak
│ │ ├── notebooks.mak
│ │ └── base.mak
│ ├── __init__.py
│ └── views.py
│ ├── requirements.txt
│ ├── setup.cfg
│ ├── setup.py
│ └── development.ini
├── .gitignore
├── NOTICE
├── setup.py
├── LICENSE
├── README.md
└── APACHE-LICENSE-2.0.txt
/lib/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/evernote/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/evernote/api/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/MANIFEST.in:
--------------------------------------------------------------------------------
1 | include README.md
2 |
--------------------------------------------------------------------------------
/lib/evernote/edam/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/sample/django/oauth/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/sample/django/evernote_oauth_sample/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/sample/django/.gitignore:
--------------------------------------------------------------------------------
1 | *.pyc
2 | dev.db
3 | oauth/config.py
--------------------------------------------------------------------------------
/lib/evernote/edam/error/__init__.py:
--------------------------------------------------------------------------------
1 | __all__ = ['ttypes', 'constants']
2 |
--------------------------------------------------------------------------------
/lib/evernote/edam/type/__init__.py:
--------------------------------------------------------------------------------
1 | __all__ = ['ttypes', 'constants']
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.pyc
2 | *.swp
3 | build
4 | dist
5 | *.egg-info
6 | .DS_Store
7 |
--------------------------------------------------------------------------------
/lib/evernote/edam/limits/__init__.py:
--------------------------------------------------------------------------------
1 | __all__ = ['ttypes', 'constants']
2 |
--------------------------------------------------------------------------------
/lib/evernote/edam/notestore/__init__.py:
--------------------------------------------------------------------------------
1 | __all__ = ['ttypes', 'constants', 'NoteStore']
2 |
--------------------------------------------------------------------------------
/lib/evernote/edam/userstore/__init__.py:
--------------------------------------------------------------------------------
1 | __all__ = ['ttypes', 'constants', 'UserStore']
2 |
--------------------------------------------------------------------------------
/sample/django/oauth/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 |
3 | # Create your models here.
4 |
--------------------------------------------------------------------------------
/sample/client/enlogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Evernote/evernote-sdk-python/HEAD/sample/client/enlogo.png
--------------------------------------------------------------------------------
/sample/django/oauth/config.py.template:
--------------------------------------------------------------------------------
1 | EN_CONSUMER_KEY = 'your consumer key'
2 | EN_CONSUMER_SECRET = 'your consumer secret'
--------------------------------------------------------------------------------
/sample/django/requirements.txt:
--------------------------------------------------------------------------------
1 | Django==1.9.2
2 | evernote==1.25.1
3 | httplib2==0.7.6
4 | oauth2==1.5.211
5 | wsgiref==0.1.2
--------------------------------------------------------------------------------
/sample/pyramid/evernote_oauth_sample/static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Evernote/evernote-sdk-python/HEAD/sample/pyramid/evernote_oauth_sample/static/favicon.ico
--------------------------------------------------------------------------------
/sample/pyramid/evernote_oauth_sample/static/footerbg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Evernote/evernote-sdk-python/HEAD/sample/pyramid/evernote_oauth_sample/static/footerbg.png
--------------------------------------------------------------------------------
/sample/pyramid/evernote_oauth_sample/static/headerbg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Evernote/evernote-sdk-python/HEAD/sample/pyramid/evernote_oauth_sample/static/headerbg.png
--------------------------------------------------------------------------------
/sample/pyramid/evernote_oauth_sample/static/middlebg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Evernote/evernote-sdk-python/HEAD/sample/pyramid/evernote_oauth_sample/static/middlebg.png
--------------------------------------------------------------------------------
/sample/pyramid/evernote_oauth_sample/static/pyramid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Evernote/evernote-sdk-python/HEAD/sample/pyramid/evernote_oauth_sample/static/pyramid.png
--------------------------------------------------------------------------------
/sample/pyramid/evernote_oauth_sample/static/transparent.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Evernote/evernote-sdk-python/HEAD/sample/pyramid/evernote_oauth_sample/static/transparent.gif
--------------------------------------------------------------------------------
/sample/pyramid/evernote_oauth_sample/static/pyramid-small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Evernote/evernote-sdk-python/HEAD/sample/pyramid/evernote_oauth_sample/static/pyramid-small.png
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | Apache Thrift
2 | Copyright 2006-2010 The Apache Software Foundation.
3 |
4 | This product includes software developed at
5 | The Apache Software Foundation (http://www.apache.org/).
--------------------------------------------------------------------------------
/sample/django/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | import os
3 | import sys
4 |
5 | if __name__ == "__main__":
6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "evernote_oauth_sample.settings")
7 |
8 | from django.core.management import execute_from_command_line
9 |
10 | execute_from_command_line(sys.argv)
11 |
--------------------------------------------------------------------------------
/sample/pyramid/evernote_oauth_sample/templates/home.mak:
--------------------------------------------------------------------------------
1 | <%inherit file="base.mak"/>
2 |
3 | <%block name="content">
4 |
5 | Click here to authorize this application to access your Evernote account. You will be directed to evernote.com to authorize access, then returned to this application after authorization is complete.
6 |
7 | %block>
8 |
9 |
--------------------------------------------------------------------------------
/sample/django/evernote_oauth_sample/urls.py:
--------------------------------------------------------------------------------
1 | from django.conf.urls import include, url
2 | from oauth import views as oauth_views
3 |
4 | urlpatterns = [
5 | url(r"^$", oauth_views.index, name="evernote_index"),
6 | url(r"^auth/$", oauth_views.auth, name="evernote_auth"),
7 | url(r"^callback/$", oauth_views.callback, name="evernote_callback"),
8 | url(r"^reset/$", oauth_views.reset, name="evernote_auth_reset"),
9 | ]
--------------------------------------------------------------------------------
/sample/pyramid/requirements.txt:
--------------------------------------------------------------------------------
1 | Chameleon==2.11
2 | Mako==0.7.3
3 | MarkupSafe==0.15
4 | PasteDeploy==1.5.0
5 | Pygments==1.6rc1
6 | WebOb==1.2.3
7 | evernote==1.25.0
8 | evernote-oauth-sample==0.0
9 | httplib2==0.7.7
10 | oauth2==1.5.211
11 | pyramid==1.4
12 | pyramid-debugtoolbar==1.0.4
13 | repoze.lru==0.6
14 | translationstring==1.1
15 | venusian==1.0a7
16 | waitress==0.8.2
17 | wsgiref==0.1.2
18 | zope.deprecation==4.0.2
19 | zope.interface==4.0.3
20 |
--------------------------------------------------------------------------------
/lib/evernote/edam/error/constants.py:
--------------------------------------------------------------------------------
1 | #
2 | # Autogenerated by Thrift Compiler (0.11.0)
3 | #
4 | # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5 | #
6 | # options string: py:new_style
7 | #
8 |
9 | from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
10 | from thrift.protocol.TProtocol import TProtocolException
11 | from thrift.TRecursive import fix_spec
12 |
13 | import sys
14 | from .ttypes import *
15 |
--------------------------------------------------------------------------------
/sample/pyramid/evernote_oauth_sample/templates/notebooks.mak:
--------------------------------------------------------------------------------
1 | <%inherit file="base.mak"/>
2 |
3 | <%block name="content">
4 |
5 | Congratulations, you have successfully authorized this application to access your Evernote account!
6 |
7 |
8 |
9 | Your account contains the following notebooks:
10 |
11 |
12 |
13 | % for notebook in notebooks:
14 | - ${notebook.name}
15 | % endfor
16 |
17 | %block>
18 |
--------------------------------------------------------------------------------
/lib/evernote/edam/notestore/constants.py:
--------------------------------------------------------------------------------
1 | #
2 | # Autogenerated by Thrift Compiler (0.11.0)
3 | #
4 | # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5 | #
6 | # options string: py:new_style
7 | #
8 |
9 | from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
10 | from thrift.protocol.TProtocol import TProtocolException
11 | from thrift.TRecursive import fix_spec
12 |
13 | import sys
14 | from .ttypes import *
15 |
--------------------------------------------------------------------------------
/sample/django/oauth/tests.py:
--------------------------------------------------------------------------------
1 | """
2 | This file demonstrates writing tests using the unittest module. These will pass
3 | when you run "manage.py test".
4 |
5 | Replace this with more appropriate tests for your application.
6 | """
7 |
8 | from django.test import TestCase
9 |
10 |
11 | class SimpleTest(TestCase):
12 | def test_basic_addition(self):
13 | """
14 | Tests that 1 + 1 always equals 2.
15 | """
16 | self.assertEqual(1 + 1, 2)
17 |
--------------------------------------------------------------------------------
/sample/django/evernote_oauth_sample/templates/oauth/index.html:
--------------------------------------------------------------------------------
1 | {% extends 'base.html' %}
2 |
3 | {% block content %}
4 |
5 | Click here to authorize this application to access your Evernote account. You will be directed to evernote.com to authorize access, then returned to this application after authorization is complete.
6 |
7 | {% endblock %}
8 |
9 |
--------------------------------------------------------------------------------
/lib/evernote/edam/userstore/constants.py:
--------------------------------------------------------------------------------
1 | #
2 | # Autogenerated by Thrift Compiler (0.11.0)
3 | #
4 | # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5 | #
6 | # options string: py:new_style
7 | #
8 |
9 | from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
10 | from thrift.protocol.TProtocol import TProtocolException
11 | from thrift.TRecursive import fix_spec
12 |
13 | import sys
14 | from .ttypes import *
15 | EDAM_VERSION_MAJOR = 1
16 | EDAM_VERSION_MINOR = 28
17 |
--------------------------------------------------------------------------------
/lib/evernote/edam/limits/ttypes.py:
--------------------------------------------------------------------------------
1 | #
2 | # Autogenerated by Thrift Compiler (0.11.0)
3 | #
4 | # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5 | #
6 | # options string: py:new_style
7 | #
8 |
9 | from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
10 | from thrift.protocol.TProtocol import TProtocolException
11 | from thrift.TRecursive import fix_spec
12 |
13 | import sys
14 |
15 | from thrift.transport import TTransport
16 | all_structs = []
17 | fix_spec(all_structs)
18 | del all_structs
19 |
--------------------------------------------------------------------------------
/sample/django/evernote_oauth_sample/templates/oauth/callback.html:
--------------------------------------------------------------------------------
1 | {% extends 'base.html' %}
2 |
3 | {% block content %}
4 |
5 | Congratulations, you have successfully authorized this application to access your Evernote account!
6 |
7 |
8 |
9 | Your account contains the following notebooks:
10 |
11 |
12 |
13 | {% for notebook in notebooks %}
14 | - {{ notebook.name }}
15 | {% endfor %}
16 |
17 |
18 | {% endblock %}
19 |
20 |
--------------------------------------------------------------------------------
/lib/evernote/edam/type/constants.py:
--------------------------------------------------------------------------------
1 | #
2 | # Autogenerated by Thrift Compiler (0.11.0)
3 | #
4 | # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5 | #
6 | # options string: py:new_style
7 | #
8 |
9 | from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
10 | from thrift.protocol.TProtocol import TProtocolException
11 | from thrift.TRecursive import fix_spec
12 |
13 | import sys
14 | from .ttypes import *
15 | CLASSIFICATION_RECIPE_USER_NON_RECIPE = "000"
16 | CLASSIFICATION_RECIPE_USER_RECIPE = "001"
17 | CLASSIFICATION_RECIPE_SERVICE_RECIPE = "002"
18 | EDAM_NOTE_SOURCE_WEB_CLIP = "web.clip"
19 | EDAM_NOTE_SOURCE_WEB_CLIP_SIMPLIFIED = "Clearly"
20 | EDAM_NOTE_SOURCE_MAIL_CLIP = "mail.clip"
21 | EDAM_NOTE_SOURCE_MAIL_SMTP_GATEWAY = "mail.smtp"
22 |
--------------------------------------------------------------------------------
/sample/pyramid/evernote_oauth_sample/static/ie6.css:
--------------------------------------------------------------------------------
1 | * html img,
2 | * html .png{position:relative;behavior:expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
3 | this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "',sizingMethod='image')",
4 | this.src = "static/transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
5 | this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "',sizingMethod='crop')",
6 | this.runtimeStyle.backgroundImage = "none")),this.pngSet=true)
7 | );}
8 | #wrap{display:table;height:100%}
9 |
--------------------------------------------------------------------------------
/sample/pyramid/setup.cfg:
--------------------------------------------------------------------------------
1 | [nosetests]
2 | match = ^test
3 | nocapture = 1
4 | cover-package = evernote_oauth_sample
5 | with-coverage = 1
6 | cover-erase = 1
7 |
8 | [compile_catalog]
9 | directory = evernote_oauth_sample/locale
10 | domain = evernote_oauth_sample
11 | statistics = true
12 |
13 | [extract_messages]
14 | add_comments = TRANSLATORS:
15 | output_file = evernote_oauth_sample/locale/evernote_oauth_sample.pot
16 | width = 80
17 |
18 | [init_catalog]
19 | domain = evernote_oauth_sample
20 | input_file = evernote_oauth_sample/locale/evernote_oauth_sample.pot
21 | output_dir = evernote_oauth_sample/locale
22 |
23 | [update_catalog]
24 | domain = evernote_oauth_sample
25 | input_file = evernote_oauth_sample/locale/evernote_oauth_sample.pot
26 | output_dir = evernote_oauth_sample/locale
27 | previous = true
28 |
--------------------------------------------------------------------------------
/sample/pyramid/evernote_oauth_sample/__init__.py:
--------------------------------------------------------------------------------
1 | from pyramid.config import Configurator
2 | from pyramid.session import UnencryptedCookieSessionFactoryConfig
3 |
4 |
5 | def main(global_config, **settings):
6 | """ This function returns a Pyramid WSGI application.
7 | """
8 | session_factory = UnencryptedCookieSessionFactoryConfig('itsaseekreet')
9 | config = Configurator(settings=settings, session_factory=session_factory)
10 | config.add_static_view('static', 'static', cache_max_age=3600)
11 | config.add_route('home', '/')
12 | config.add_route('evernote_auth', '/auth')
13 | config.add_route('evernote_callback', '/callback')
14 | config.add_route('evernote_auth_reset', '/reset')
15 | config.add_route('notebooks', '/notebooks')
16 | config.scan()
17 | return config.make_wsgi_app()
18 |
--------------------------------------------------------------------------------
/sample/django/evernote_oauth_sample/templates/base.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Evernote Python OAuth Demo
4 |
5 |
6 | Evernote Python OAuth Demo
7 |
8 |
9 | This application uses the Django framework to demonstrate the use of OAuth to authenticate to the Evernote web service. OAuth support is implemented using the oauth2.
10 |
11 |
12 |
13 | On this page, we demonstrate how OAuth authentication might work in the real world.
14 | To see a step-by-step demonstration of how OAuth works, see EDAMTest.py.
15 |
16 |
17 |
18 |
19 | Evernote Authentication
20 |
21 | {% block content %}{% endblock %}
22 |
23 |
24 |
25 |
26 | Click here to start over
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/sample/pyramid/evernote_oauth_sample/templates/base.mak:
--------------------------------------------------------------------------------
1 |
2 |
3 | Evernote Python OAuth Demo
4 |
5 |
6 | Evernote Python OAuth Demo
7 |
8 |
9 | This application uses the Pyramid framework to demonstrate the use of OAuth to authenticate to the Evernote web service. OAuth support is implemented using the oauth2.
10 |
11 |
12 |
13 | On this page, we demonstrate how OAuth authentication might work in the real world.
14 | To see a step-by-step demonstration of how OAuth works, see EDAMTest.py.
15 |
16 |
17 |
18 |
19 | Evernote Authentication
20 |
21 | <%block name="content">%block>
22 |
23 |
24 |
25 |
26 | Click here to start over
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/sample/pyramid/setup.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from setuptools import setup, find_packages
4 |
5 | here = os.path.abspath(os.path.dirname(__file__))
6 |
7 | requires = [
8 | 'pyramid',
9 | 'pyramid_debugtoolbar',
10 | 'waitress',
11 | 'oauth2',
12 | 'evernote'
13 | ]
14 |
15 | setup(name='evernote_oauth_sample',
16 | version='0.0',
17 | description='evernote_oauth_sample',
18 | classifiers=[
19 | "Programming Language :: Python",
20 | "Framework :: Pyramid",
21 | "Topic :: Internet :: WWW/HTTP",
22 | "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
23 | ],
24 | author='',
25 | author_email='',
26 | url='',
27 | keywords='web pyramid pylons',
28 | packages=find_packages(),
29 | include_package_data=True,
30 | zip_safe=False,
31 | install_requires=requires,
32 | tests_require=requires,
33 | test_suite="evernote_oauth_sample",
34 | entry_points="""\
35 | [paste.app_factory]
36 | main = evernote_oauth_sample:main
37 | """,
38 | )
39 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | import os
2 | from setuptools import setup, find_packages
3 |
4 | constants = open('lib/evernote/edam/userstore/constants.py').read().split("\n")
5 | for x in [x for x in constants if x.startswith('EDAM_VERSION')]:
6 | exec x
7 |
8 |
9 | def read(fname):
10 | return open(os.path.join(os.path.dirname(__file__), fname)).read()
11 |
12 |
13 | setup(
14 | name='evernote',
15 | version="%i.%i.0" % (EDAM_VERSION_MAJOR, EDAM_VERSION_MINOR),
16 | author='Evernote Corporation',
17 | author_email='api@evernote.com',
18 | url='http://dev.evernote.com',
19 | description='Evernote SDK for Python',
20 | long_description=read('README.md'),
21 | packages=find_packages('lib'),
22 | packages=find_packages('lib',exclude=["*.thrift", "*.thrift.*", "thrift.*", "thrift"]),
23 | classifiers=[
24 | 'Development Status :: 5 - Production/Stable',
25 | 'Intended Audience :: Developers',
26 | 'License :: OSI Approved :: BSD License',
27 | 'Topic :: Software Development :: Libraries',
28 | ],
29 | license='BSD',
30 | install_requires=[
31 | 'thrift',
32 | 'oauth2',
33 | ],
34 | )
35 |
--------------------------------------------------------------------------------
/sample/django/evernote_oauth_sample/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for evernote_oauth_sample project.
3 |
4 | This module contains the WSGI application used by Django's development server
5 | and any production WSGI deployments. It should expose a module-level variable
6 | named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
7 | this application via the ``WSGI_APPLICATION`` setting.
8 |
9 | Usually you will have the standard Django WSGI application here, but it also
10 | might make sense to replace the whole Django WSGI application with a custom one
11 | that later delegates to the Django one. For example, you could introduce WSGI
12 | middleware here, or combine a Django application with an application of another
13 | framework.
14 |
15 | """
16 | import os
17 |
18 | os.environ.setdefault(
19 | "DJANGO_SETTINGS_MODULE", "evernote_oauth_sample.settings")
20 |
21 | # This application object is used by any WSGI server configured to use this
22 | # file. This includes Django's development server, if the WSGI_APPLICATION
23 | # setting points here.
24 | from django.core.wsgi import get_wsgi_application
25 | application = get_wsgi_application()
26 |
27 | # Apply WSGI middleware here.
28 | # from helloworld.wsgi import HelloWorldApplication
29 | # application = HelloWorldApplication(application)
30 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2007-2012 by Evernote Corporation, All rights reserved.
3 | *
4 | * Use of the source code and binary libraries included in this package
5 | * is permitted under the following terms:
6 | *
7 | * Redistribution and use in source and binary forms, with or without
8 | * modification, are permitted provided that the following conditions
9 | * are met:
10 | *
11 | * 1. Redistributions of source code must retain the above copyright
12 | * notice, this list of conditions and the following disclaimer.
13 | * 2. Redistributions in binary form must reproduce the above copyright
14 | * notice, this list of conditions and the following disclaimer in the
15 | * documentation and/or other materials provided with the distribution.
16 | *
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 | */
28 |
--------------------------------------------------------------------------------
/sample/pyramid/development.ini:
--------------------------------------------------------------------------------
1 | ###
2 | # app configuration
3 | # http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
4 | ###
5 |
6 | [app:main]
7 | use = egg:evernote_oauth_sample
8 |
9 | pyramid.reload_templates = true
10 | pyramid.debug_authorization = false
11 | pyramid.debug_notfound = false
12 | pyramid.debug_routematch = false
13 | pyramid.default_locale_name = en
14 | pyramid.includes =
15 | pyramid_debugtoolbar
16 |
17 | mako.directories = evernote_oauth_sample:templates
18 |
19 | evernote.consumer_key = your_consumer_key
20 | evernote.consumer_secret = your_consumer_secret
21 |
22 | # By default, the toolbar only appears for clients from IP addresses
23 | # '127.0.0.1' and '::1'.
24 | # debugtoolbar.hosts = 127.0.0.1 ::1
25 |
26 | ###
27 | # wsgi server configuration
28 | ###
29 |
30 | [server:main]
31 | use = egg:waitress#main
32 | host = 127.0.0.1
33 | port = 6543
34 |
35 | ###
36 | # logging configuration
37 | # http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
38 | ###
39 |
40 | [loggers]
41 | keys = root, evernote_oauth_sample
42 |
43 | [handlers]
44 | keys = console
45 |
46 | [formatters]
47 | keys = generic
48 |
49 | [logger_root]
50 | level = INFO
51 | handlers = console
52 |
53 | [logger_evernote_oauth_sample]
54 | level = DEBUG
55 | handlers =
56 | qualname = evernote_oauth_sample
57 |
58 | [handler_console]
59 | class = StreamHandler
60 | args = (sys.stderr,)
61 | level = NOTSET
62 | formatter = generic
63 |
64 | [formatter_generic]
65 | format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
66 |
--------------------------------------------------------------------------------
/sample/django/oauth/views.py:
--------------------------------------------------------------------------------
1 | from evernote.api.client import EvernoteClient
2 |
3 | from django.core.urlresolvers import reverse
4 | from django.shortcuts import render_to_response
5 | from django.shortcuts import redirect
6 | # rename config.py.template to config.py and paste your credentials.
7 | from config import EN_CONSUMER_KEY, EN_CONSUMER_SECRET
8 |
9 | def get_evernote_client(token=None):
10 | if token:
11 | return EvernoteClient(token=token, sandbox=True)
12 | else:
13 | return EvernoteClient(
14 | consumer_key=EN_CONSUMER_KEY,
15 | consumer_secret=EN_CONSUMER_SECRET,
16 | sandbox=True
17 | )
18 |
19 |
20 | def index(request):
21 | return render_to_response('oauth/index.html')
22 |
23 |
24 | def auth(request):
25 | client = get_evernote_client()
26 | callbackUrl = 'http://%s%s' % (
27 | request.get_host(), reverse('evernote_callback'))
28 | request_token = client.get_request_token(callbackUrl)
29 |
30 | # Save the request token information for later
31 | request.session['oauth_token'] = request_token['oauth_token']
32 | request.session['oauth_token_secret'] = request_token['oauth_token_secret']
33 |
34 | # Redirect the user to the Evernote authorization URL
35 | return redirect(client.get_authorize_url(request_token))
36 |
37 |
38 | def callback(request):
39 | try:
40 | client = get_evernote_client()
41 | client.get_access_token(
42 | request.session['oauth_token'],
43 | request.session['oauth_token_secret'],
44 | request.GET.get('oauth_verifier', '')
45 | )
46 | except KeyError:
47 | return redirect('/')
48 |
49 | note_store = client.get_note_store()
50 | notebooks = note_store.listNotebooks()
51 |
52 | return render_to_response('oauth/callback.html', {'notebooks': notebooks})
53 |
54 |
55 | def reset(request):
56 | return redirect('/')
57 |
--------------------------------------------------------------------------------
/sample/pyramid/evernote_oauth_sample/views.py:
--------------------------------------------------------------------------------
1 | from pyramid.view import view_config
2 | from pyramid.httpexceptions import HTTPFound, HTTPBadRequest
3 | from evernote.api.client import EvernoteClient
4 |
5 |
6 | def _get_evernote_client(request):
7 | session = request.session
8 | access_token = session.get('access_token')
9 |
10 | if access_token:
11 | return EvernoteClient(
12 | token=access_token,
13 | sandbox=True)
14 | else:
15 | settings = request.registry.settings
16 | consumer_key = settings.get('evernote.consumer_key')
17 | consumer_secret = settings.get('evernote.consumer_secret')
18 |
19 | return EvernoteClient(
20 | consumer_key=consumer_key,
21 | consumer_secret=consumer_secret,
22 | sandbox=True)
23 |
24 |
25 | @view_config(route_name='home', renderer='home.mak')
26 | def home(request):
27 | return {}
28 |
29 |
30 | @view_config(route_name='evernote_auth')
31 | def evernote_oauth(request):
32 | session = request.session
33 | session.invalidate()
34 |
35 | client = _get_evernote_client(request)
36 | request_token = client.get_request_token(
37 | request.route_url('evernote_callback'))
38 | session['oauth_token'] = request_token['oauth_token']
39 | session['oauth_token_secret'] = request_token['oauth_token_secret']
40 |
41 | authorized_url = client.get_authorize_url(request_token)
42 |
43 | return HTTPFound(authorized_url)
44 |
45 |
46 | @view_config(route_name='evernote_callback', renderer='callback.mak')
47 | def evernote_callback(request):
48 | client = _get_evernote_client(request)
49 | session = request.session
50 |
51 | oauth_verifier = request.params.get('oauth_verifier')
52 | oauth_token = session.get('oauth_token')
53 | oauth_token_secret = session.get('oauth_token_secret')
54 |
55 | if oauth_verifier and oauth_token and oauth_token_secret:
56 | access_token = client.get_access_token(
57 | oauth_token,
58 | oauth_token_secret,
59 | oauth_verifier)
60 |
61 | session['access_token'] = access_token
62 |
63 | return HTTPFound('notebooks')
64 |
65 | return HTTPBadRequest(
66 | 'oauth_verifier, oauth_token or oauth_token_secret not found')
67 |
68 |
69 | @view_config(route_name='notebooks', renderer='notebooks.mak')
70 | def notebooks(request):
71 | client = _get_evernote_client(request)
72 | note_store = client.get_note_store()
73 | return {'notebooks': note_store.listNotebooks()}
74 |
75 |
76 | @view_config(route_name='evernote_auth_reset')
77 | def evernote_oauth_rest(request):
78 | request.session.invalidate()
79 | return HTTPFound(request.route_url('home'))
80 |
--------------------------------------------------------------------------------
/sample/client/EDAMTest.py:
--------------------------------------------------------------------------------
1 | #
2 | # A simple Evernote API demo script that lists all notebooks in the user's
3 | # account and creates a simple test note in the default notebook.
4 | #
5 | # Before running this sample, you must fill in your Evernote developer token.
6 | #
7 | # To run (Unix):
8 | # export PYTHONPATH=../../lib; python EDAMTest.py
9 | #
10 |
11 | import hashlib
12 | import binascii
13 | import evernote.edam.userstore.constants as UserStoreConstants
14 | import evernote.edam.type.ttypes as Types
15 |
16 | from evernote.api.client import EvernoteClient
17 |
18 | # Real applications authenticate with Evernote using OAuth, but for the
19 | # purpose of exploring the API, you can get a developer token that allows
20 | # you to access your own Evernote account. To get a developer token, visit
21 | # https://SERVICE_HOST/api/DeveloperToken.action
22 | #
23 | # There are three Evernote services:
24 | #
25 | # Sandbox: https://sandbox.evernote.com/
26 | # Production (International): https://www.evernote.com/
27 | # Production (China): https://app.yinxiang.com/
28 | #
29 | # For more information about Sandbox and Evernote China services, please
30 | # refer to https://dev.evernote.com/doc/articles/testing.php
31 | # and https://dev.evernote.com/doc/articles/bootstrap.php
32 |
33 | auth_token = "your developer token"
34 |
35 | if auth_token == "your developer token":
36 | print "Please fill in your developer token"
37 | print "To get a developer token, visit " \
38 | "https://sandbox.evernote.com/api/DeveloperToken.action"
39 | exit(1)
40 |
41 |
42 | # To access Sandbox service, set sandbox to True
43 | # To access production (International) service, set both sandbox and china to False
44 | # To access production (China) service, set sandbox to False and china to True
45 | sandbox = True
46 | china = False
47 |
48 | # Initial development is performed on our sandbox server. To use the production
49 | # service, change sandbox=False and replace your
50 | # developer token above with a token from
51 | # https://www.evernote.com/api/DeveloperToken.action
52 | client = EvernoteClient(token=auth_token, sandbox=sandbox, china=china)
53 |
54 | user_store = client.get_user_store()
55 |
56 | version_ok = user_store.checkVersion(
57 | "Evernote EDAMTest (Python)",
58 | UserStoreConstants.EDAM_VERSION_MAJOR,
59 | UserStoreConstants.EDAM_VERSION_MINOR
60 | )
61 | print "Is my Evernote API version up to date? ", str(version_ok)
62 | print ""
63 | if not version_ok:
64 | exit(1)
65 |
66 | note_store = client.get_note_store()
67 |
68 | # List all of the notebooks in the user's account
69 | notebooks = note_store.listNotebooks()
70 | print "Found ", len(notebooks), " notebooks:"
71 | for notebook in notebooks:
72 | print " * ", notebook.name
73 |
74 | print
75 | print "Creating a new note in the default notebook"
76 | print
77 |
78 | # To create a new note, simply create a new Note object and fill in
79 | # attributes such as the note's title.
80 | note = Types.Note()
81 | note.title = "Test note from EDAMTest.py"
82 |
83 | # To include an attachment such as an image in a note, first create a Resource
84 | # for the attachment. At a minimum, the Resource contains the binary attachment
85 | # data, an MD5 hash of the binary data, and the attachment MIME type.
86 | # It can also include attributes such as filename and location.
87 | image = open('enlogo.png', 'rb').read()
88 | md5 = hashlib.md5()
89 | md5.update(image)
90 | hash = md5.digest()
91 |
92 | data = Types.Data()
93 | data.size = len(image)
94 | data.bodyHash = hash
95 | data.body = image
96 |
97 | resource = Types.Resource()
98 | resource.mime = 'image/png'
99 | resource.data = data
100 |
101 | # Now, add the new Resource to the note's list of resources
102 | note.resources = [resource]
103 |
104 | # To display the Resource as part of the note's content, include an
105 | # tag in the note's ENML content. The en-media tag identifies the corresponding
106 | # Resource using the MD5 hash.
107 | hash_hex = binascii.hexlify(hash)
108 |
109 | # The content of an Evernote note is represented using Evernote Markup Language
110 | # (ENML). The full ENML specification can be found in the Evernote API Overview
111 | # at http://dev.evernote.com/documentation/cloud/chapters/ENML.php
112 | note.content = ''
113 | note.content += ''
115 | note.content += 'Here is the Evernote logo:
'
116 | note.content += ''
117 | note.content += ''
118 |
119 | # Finally, send the new note to Evernote using the createNote method
120 | # The new Note object that is returned will contain server-generated
121 | # attributes such as the new note's unique GUID.
122 | created_note = note_store.createNote(note)
123 |
124 | print "Successfully created a new note with GUID: ", created_note.guid
125 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Evernote SDK for Python
2 | ============================================
3 |
4 | Evernote API version 1.28
5 |
6 | This SDK is intended for use with Python 2.X
7 |
8 | Overview
9 | --------
10 | This SDK contains wrapper code used to call the Evernote Cloud API from Python.
11 |
12 | The SDK also contains a sample script. The code demonstrates the basic use of the SDK for single-user scripts. Real web applications must use OAuth to authenticate to the Evernote service.
13 |
14 | Prerequisites
15 | -------------
16 | In order to use the code in this SDK, you need to obtain an API key from http://dev.evernote.com/documentation/cloud. You'll also find full API documentation on that page.
17 |
18 | In order to run the sample code, you need a user account on the sandbox service where you will do your development. Sign up for an account at https://sandbox.evernote.com/Registration.action
19 |
20 | In order to run the client client sample code, you need a developer token. Get one at https://sandbox.evernote.com/api/DeveloperToken.action
21 |
22 | Getting Started - Client
23 | ------------------------
24 | The code in `sample/client/EDAMTest.py` demonstrates the basics of using the Evernote API, using developer tokens to simplify the authentication process while you're learning.
25 |
26 | 1. Open `sample/client/EDAMTest.py`
27 | 2. Scroll down and fill in your Evernote developer token.
28 | 3. On the command line, run the following command to execute the script:
29 |
30 | ```bash
31 | $ export PYTHONPATH=../../lib; python EDAMTest.py
32 | ```
33 |
34 | Getting Started - Django with OAuth
35 | ------------------------------------
36 | Web applications must use OAuth to authenticate to the Evernote service. The code in sample/django contains a simple web apps that demonstrate the OAuth authentication process. The application use the Django framework. You don't need to use Django for your application, but you'll need it to run the sample code.
37 |
38 | 1. Install `django`, `oauth2` and `evernote` library. You can also use `requirements.txt` for `pip`.
39 | 2. Open the file `oauth/views.py`
40 | 3. Fill in your Evernote API consumer key and secret.
41 | 4. On the command line, run the following command to start the sample app:
42 |
43 | ```bash
44 | $ python manage.py runserver
45 | ```
46 |
47 | 5. Open the sample app in your browser: `http://localhost:8000`
48 |
49 | Getting Started - Pyramid with OAuth
50 | -------------------------------------
51 | If you want to use Evernote API with Pyramid, the code in sample/pyramid will be good start.
52 |
53 | 1. Install the sample project using pip on your command line like this.
54 |
55 | ```bash
56 | $ pip install -e .
57 | ```
58 |
59 | 2. Open the file `development.ini`
60 | 3. Fill in your Evernote API consumer key and secret.
61 | 4. On the command line, run the following command to start the sample app:
62 |
63 | ```bash
64 | $ pserve development.ini
65 | ```
66 |
67 | 5. Open the sample app in your browser: `http://localhost:6543`
68 |
69 |
70 | Usage
71 | -----
72 | ### OAuth ###
73 | ```python
74 | client = EvernoteClient(
75 | consumer_key='YOUR CONSUMER KEY',
76 | consumer_secret='YOUR CONSUMER SECRET',
77 | sandbox=True # Default: True
78 | )
79 | request_token = client.get_request_token('YOUR CALLBACK URL')
80 | client.get_authorize_url(request_token)
81 | => https://sandbox.evernote.com/OAuth.action?oauth_token=OAUTH_TOKEN
82 | ```
83 | To obtain the access token
84 | ```python
85 | access_token = client.get_access_token(
86 | request_token['oauth_token'],
87 | request_token['oauth_token_secret'],
88 | request.GET.get('oauth_verifier', '')
89 | )
90 | ```
91 | Now you can make other API calls
92 | ```python
93 | client = EvernoteClient(token=access_token)
94 | note_store = client.get_note_store()
95 | notebooks = note_store.listNotebooks()
96 | ```
97 |
98 | ### UserStore ###
99 | Once you acquire token, you can use UserStore. For example, if you want to call UserStore.getUser:
100 | ```python
101 | client = EvernoteClient(token=access_token)
102 | user_store = client.get_user_store()
103 | user_store.getUser()
104 | ```
105 | You can omit authenticationToken in the arguments of UserStore functions.
106 |
107 | ### NoteStore ###
108 | If you want to call NoteStore.listNotebooks:
109 | ```python
110 | note_store = client.get_note_store()
111 | note_store.listNotebooks()
112 | ```
113 |
114 | ### NoteStore for linked notebooks ###
115 | If you want to get tags for linked notebooks:
116 | ```python
117 | linked_notebook = note_store.listLinkedNotebooks()[0]
118 | shared_note_store = client.getSharedNoteStore(linked_notebook)
119 | shared_notebook = shared_note_store.getSharedNotebookByAuth()
120 | shared_note_store.listTagsByNotebook(shared_notebook.notebookGuid)
121 | ```
122 |
123 | ### NoteStore for Business ###
124 | If you want to get the list of notebooks in your business account:
125 | ```python
126 | business_note_store = client.get_business_note_store()
127 | business_note_store.listNotebooks()
128 | ```
129 |
130 | ### References ###
131 | - Evernote Developers: http://dev.evernote.com/
132 | - API Document: http://dev.evernote.com/documentation/reference/
133 |
134 |
135 | Known Issues
136 | ------------
137 | ### Regular expressions ###
138 | In general, the ["re" regex module](http://docs.python.org/2/library/re.html) doesn't handle some of our regular expressions in [Limits](https://github.com/evernote/evernote-sdk-python/blob/master/lib/evernote/edam/limits/constants.py), but [re2](https://pypi.python.org/pypi/re2/) does.
139 |
--------------------------------------------------------------------------------
/sample/django/evernote_oauth_sample/settings.py:
--------------------------------------------------------------------------------
1 | # Django settings for evernote_oauth_sample project.
2 | import os
3 | BASE_DIR = os.path.dirname(os.path.abspath(__file__))
4 |
5 | DEBUG = True
6 |
7 | ADMINS = (
8 | # ('Your Name', 'your_email@example.com'),
9 | )
10 |
11 | MANAGERS = ADMINS
12 |
13 | DATABASES = {
14 | 'default': {
15 | 'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
16 | 'NAME': '', # Or path to database file if using sqlite3.
17 | 'USER': '', # Not used with sqlite3.
18 | 'PASSWORD': '', # Not used with sqlite3.
19 | 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
20 | 'PORT': '', # Set to empty string for default. Not used with sqlite3.
21 | }
22 | }
23 |
24 | # Local time zone for this installation. Choices can be found here:
25 | # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
26 | # although not all choices may be available on all operating systems.
27 | # In a Windows environment this must be set to your system time zone.
28 | TIME_ZONE = 'America/Chicago'
29 |
30 | # Language code for this installation. All choices can be found here:
31 | # http://www.i18nguy.com/unicode/language-identifiers.html
32 | LANGUAGE_CODE = 'en-us'
33 |
34 | SITE_ID = 1
35 |
36 | # If you set this to False, Django will make some optimizations so as not
37 | # to load the internationalization machinery.
38 | USE_I18N = True
39 |
40 | # If you set this to False, Django will not format dates, numbers and
41 | # calendars according to the current locale.
42 | USE_L10N = True
43 |
44 | # If you set this to False, Django will not use timezone-aware datetimes.
45 | USE_TZ = True
46 |
47 | # Absolute filesystem path to the directory that will hold user-uploaded files.
48 | # Example: "/home/media/media.lawrence.com/media/"
49 | MEDIA_ROOT = ''
50 |
51 | # URL that handles the media served from MEDIA_ROOT. Make sure to use a
52 | # trailing slash.
53 | # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
54 | MEDIA_URL = ''
55 |
56 | # Absolute path to the directory static files should be collected to.
57 | # Don't put anything in this directory yourself; store your static files
58 | # in apps' "static/" subdirectories and in STATICFILES_DIRS.
59 | # Example: "/home/media/media.lawrence.com/static/"
60 | STATIC_ROOT = ''
61 |
62 | # URL prefix for static files.
63 | # Example: "http://media.lawrence.com/static/"
64 | STATIC_URL = '/static/'
65 |
66 | # Additional locations of static files
67 | STATICFILES_DIRS = (
68 | # Put strings here, like "/home/html/static" or "C:/www/django/static".
69 | # Always use forward slashes, even on Windows.
70 | # Don't forget to use absolute paths, not relative paths.
71 | )
72 |
73 | # List of finder classes that know how to find static files in
74 | # various locations.
75 | STATICFILES_FINDERS = (
76 | 'django.contrib.staticfiles.finders.FileSystemFinder',
77 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
78 | # 'django.contrib.staticfiles.finders.DefaultStorageFinder',
79 | )
80 |
81 | # Make this unique, and don't share it with anybody.
82 | SECRET_KEY = '6%0s^4-@_16sk82@s_97!$%292(j^uaxuj(+0nxtl$n3#y+nr+'
83 |
84 | TEMPLATES = [
85 | {
86 | 'BACKEND': 'django.template.backends.django.DjangoTemplates',
87 | 'DIRS': [
88 | # os.path.join(BASE_DIR, 'templates'),
89 | 'evernote_oauth_sample/templates',
90 | # insert your TEMPLATE_DIRS here
91 | ],
92 | 'APP_DIRS': True,
93 |
94 | 'OPTIONS': {
95 | 'context_processors': [
96 | # Insert your TEMPLATE_CONTEXT_PROCESSORS here or use this
97 | # list if you haven't customized them:
98 | 'django.contrib.auth.context_processors.auth',
99 | 'django.template.context_processors.debug',
100 | 'django.template.context_processors.i18n',
101 | 'django.template.context_processors.media',
102 | 'django.template.context_processors.static',
103 | 'django.template.context_processors.tz',
104 | 'django.contrib.messages.context_processors.messages',
105 | ],
106 | },
107 | },
108 | ]
109 |
110 | MIDDLEWARE_CLASSES = (
111 | 'django.middleware.common.CommonMiddleware',
112 | 'django.contrib.sessions.middleware.SessionMiddleware',
113 | 'django.middleware.csrf.CsrfViewMiddleware',
114 | 'django.contrib.auth.middleware.AuthenticationMiddleware',
115 | 'django.contrib.messages.middleware.MessageMiddleware',
116 | # Uncomment the next line for simple clickjacking protection:
117 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
118 | )
119 |
120 | SESSION_ENGINE = "django.contrib.sessions.backends.cache"
121 |
122 | CACHES = {
123 | 'default': {
124 | 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
125 | 'LOCATION': 'unique-snowflake'
126 | }
127 | }
128 |
129 | ROOT_URLCONF = 'evernote_oauth_sample.urls'
130 |
131 | # Python dotted path to the WSGI application used by Django's runserver.
132 | WSGI_APPLICATION = 'evernote_oauth_sample.wsgi.application'
133 |
134 | import os
135 | BASE_DIR = os.path.abspath(os.path.dirname(__file__))
136 |
137 | INSTALLED_APPS = (
138 | 'django.contrib.auth',
139 | 'django.contrib.contenttypes',
140 | 'django.contrib.sessions',
141 | 'django.contrib.sites',
142 | 'django.contrib.messages',
143 | 'django.contrib.staticfiles',
144 | 'oauth'
145 | # Uncomment the next line to enable the admin:
146 | # 'django.contrib.admin',
147 | # Uncomment the next line to enable admin documentation:
148 | # 'django.contrib.admindocs',
149 | )
150 |
151 | # A sample logging configuration. The only tangible logging
152 | # performed by this configuration is to send an email to
153 | # the site admins on every HTTP 500 error when DEBUG=False.
154 | # See http://docs.djangoproject.com/en/dev/topics/logging for
155 | # more details on how to customize your logging configuration.
156 | LOGGING = {
157 | 'version': 1,
158 | 'disable_existing_loggers': False,
159 | 'filters': {
160 | 'require_debug_false': {
161 | '()': 'django.utils.log.RequireDebugFalse'
162 | }
163 | },
164 | 'handlers': {
165 | 'mail_admins': {
166 | 'level': 'ERROR',
167 | 'filters': ['require_debug_false'],
168 | 'class': 'django.utils.log.AdminEmailHandler'
169 | }
170 | },
171 | 'loggers': {
172 | 'django.request': {
173 | 'handlers': ['mail_admins'],
174 | 'level': 'ERROR',
175 | 'propagate': True,
176 | },
177 | }
178 | }
179 |
--------------------------------------------------------------------------------
/lib/evernote/api/client.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import functools
3 | import inspect
4 | import re
5 | import oauth2 as oauth
6 | import urllib
7 | import urlparse
8 |
9 | import evernote.edam.userstore.UserStore as UserStore
10 | import evernote.edam.notestore.NoteStore as NoteStore
11 | import evernote.edam.userstore.constants as UserStoreConstants
12 |
13 | import thrift.protocol.TBinaryProtocol as TBinaryProtocol
14 | import thrift.transport.THttpClient as THttpClient
15 |
16 |
17 | class EvernoteClient(object):
18 |
19 | def __init__(self, **options):
20 | self.consumer_key = options.get('consumer_key')
21 | self.consumer_secret = options.get('consumer_secret')
22 | self.sandbox = options.get('sandbox', True)
23 | self.china = options.get('china', False)
24 | if self.sandbox:
25 | default_service_host = 'sandbox.evernote.com'
26 | elif self.china:
27 | default_service_host = 'app.yinxiang.com'
28 | else:
29 | default_service_host = 'www.evernote.com'
30 | self.service_host = options.get('service_host', default_service_host)
31 | self.additional_headers = options.get('additional_headers', {})
32 | self.token = options.get('token')
33 | self.secret = options.get('secret')
34 |
35 | def get_request_token(self, callback_url):
36 | client = self._get_oauth_client()
37 | request_url = '%s?oauth_callback=%s' % (
38 | self._get_endpoint('oauth'), urllib.quote(callback_url))
39 |
40 | resp, content = client.request(request_url, 'GET')
41 | request_token = dict(urlparse.parse_qsl(content))
42 | return request_token
43 |
44 | def get_authorize_url(self, request_token):
45 | return '%s?oauth_token=%s' % (
46 | self._get_endpoint('OAuth.action'),
47 | urllib.quote(request_token['oauth_token']))
48 |
49 | def get_access_token_dict(
50 | self, oauth_token, oauth_token_secret, oauth_verifier
51 | ):
52 | token = oauth.Token(oauth_token, oauth_token_secret)
53 | token.set_verifier(oauth_verifier)
54 | client = self._get_oauth_client(token)
55 |
56 | resp, content = client.request(self._get_endpoint('oauth'), 'POST')
57 | access_token_dict = dict(urlparse.parse_qsl(content))
58 | self.token = access_token_dict['oauth_token']
59 | return access_token_dict
60 |
61 | def get_access_token(
62 | self, oauth_token, oauth_token_secret, oauth_verifier
63 | ):
64 | access_token_dict = self.get_access_token_dict(
65 | oauth_token,
66 | oauth_token_secret,
67 | oauth_verifier
68 | )
69 | return access_token_dict['oauth_token']
70 |
71 | def get_user_store(self):
72 | user_store_uri = self._get_endpoint("/edam/user")
73 | store = Store(self.token, UserStore.Client, user_store_uri)
74 | if not store: # Trick for PyDev code completion
75 | store = UserStore.Client()
76 | raise Exception('Should never reach here')
77 | return store
78 |
79 | def get_note_store(self):
80 | user_store = self.get_user_store()
81 | note_store_uri = user_store.getUserUrls().noteStoreUrl
82 | store = Store(self.token, NoteStore.Client, note_store_uri)
83 | if not store: # Trick for PyDev code completion
84 | store = NoteStore.Client()
85 | raise Exception('Should never reach here')
86 | return store
87 |
88 | def get_shared_note_store(self, linkedNotebook):
89 | note_store_uri = linkedNotebook.noteStoreUrl
90 | note_store = Store(self.token, NoteStore.Client, note_store_uri)
91 | shared_auth = note_store.authenticateToSharedNotebook(
92 | linkedNotebook.shareKey)
93 | shared_token = shared_auth.authenticationToken
94 | store = Store(shared_token, NoteStore.Client, note_store_uri)
95 | if not store: # Trick for PyDev code completion
96 | store = NoteStore.Client()
97 | raise Exception('Should never reach here')
98 | return store
99 |
100 | def get_business_note_store(self):
101 | user_store = self.get_user_store()
102 | biz_auth = user_store.authenticateToBusiness()
103 | biz_token = biz_auth.authenticationToken
104 | note_store_uri = biz_auth.noteStoreUrl
105 | store = Store(biz_token, NoteStore.Client, note_store_uri)
106 | if not store: # Trick for PyDev code completion
107 | store = NoteStore.Client()
108 | raise Exception('Should never reach here')
109 | return store
110 |
111 | def _get_oauth_client(self, token=None):
112 | consumer = oauth.Consumer(self.consumer_key, self.consumer_secret)
113 | if token:
114 | client = oauth.Client(consumer, token)
115 | else:
116 | client = oauth.Client(consumer)
117 | return client
118 |
119 | def _get_endpoint(self, path=None):
120 | url = "https://%s" % (self.service_host)
121 | if path is not None:
122 | url += "/%s" % path
123 | return url
124 |
125 |
126 | class Store(object):
127 |
128 | def __init__(self, token, client_class, store_url):
129 | self.token = token
130 | m = re.search(':A=(.+):', token)
131 | if m:
132 | self._user_agent_id = m.groups()[0]
133 | else:
134 | self._user_agent_id = ''
135 | self._client = self._get_thrift_client(client_class, store_url)
136 |
137 | def __getattr__(self, name):
138 | def delegate_method(*args, **kwargs):
139 | targetMethod = getattr(self._client, name, None)
140 | if targetMethod is None:
141 | return object.__getattribute__(self, name)(*args, **kwargs)
142 |
143 | org_args = inspect.getargspec(targetMethod).args
144 | if len(org_args) == len(args) + 1:
145 | return targetMethod(*args, **kwargs)
146 | elif 'authenticationToken' in org_args:
147 | skip_args = ['self', 'authenticationToken']
148 | arg_names = [i for i in org_args if i not in skip_args]
149 | return functools.partial(
150 | targetMethod, authenticationToken=self.token
151 | )(**dict(zip(arg_names, args)))
152 | else:
153 | return targetMethod(*args, **kwargs)
154 |
155 | return delegate_method
156 |
157 | def _get_thrift_client(self, client_class, url):
158 | http_client = THttpClient.THttpClient(url)
159 | http_client.setCustomHeaders({
160 | 'User-Agent': "%s / %s; Python / %s;"
161 | % (self._user_agent_id, self._get_sdk_version(), sys.version.replace('\n',""))
162 | })
163 |
164 | thrift_protocol = TBinaryProtocol.TBinaryProtocol(http_client)
165 | return client_class(thrift_protocol)
166 |
167 | def _get_sdk_version(self):
168 | return '%s.%s' % (
169 | UserStoreConstants.EDAM_VERSION_MAJOR,
170 | UserStoreConstants.EDAM_VERSION_MINOR
171 | )
172 |
--------------------------------------------------------------------------------
/sample/pyramid/evernote_oauth_sample/static/pylons.css:
--------------------------------------------------------------------------------
1 | html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td
2 | {
3 | margin: 0;
4 | padding: 0;
5 | border: 0;
6 | outline: 0;
7 | font-size: 100%; /* 16px */
8 | vertical-align: baseline;
9 | background: transparent;
10 | }
11 |
12 | body
13 | {
14 | line-height: 1;
15 | }
16 |
17 | ol, ul
18 | {
19 | list-style: none;
20 | }
21 |
22 | blockquote, q
23 | {
24 | quotes: none;
25 | }
26 |
27 | blockquote:before, blockquote:after, q:before, q:after
28 | {
29 | content: '';
30 | content: none;
31 | }
32 |
33 | :focus
34 | {
35 | outline: 0;
36 | }
37 |
38 | ins
39 | {
40 | text-decoration: none;
41 | }
42 |
43 | del
44 | {
45 | text-decoration: line-through;
46 | }
47 |
48 | table
49 | {
50 | border-collapse: collapse;
51 | border-spacing: 0;
52 | }
53 |
54 | sub
55 | {
56 | vertical-align: sub;
57 | font-size: smaller;
58 | line-height: normal;
59 | }
60 |
61 | sup
62 | {
63 | vertical-align: super;
64 | font-size: smaller;
65 | line-height: normal;
66 | }
67 |
68 | ul, menu, dir
69 | {
70 | display: block;
71 | list-style-type: disc;
72 | margin: 1em 0;
73 | padding-left: 40px;
74 | }
75 |
76 | ol
77 | {
78 | display: block;
79 | list-style-type: decimal-leading-zero;
80 | margin: 1em 0;
81 | padding-left: 40px;
82 | }
83 |
84 | li
85 | {
86 | display: list-item;
87 | }
88 |
89 | ul ul, ul ol, ul dir, ul menu, ul dl, ol ul, ol ol, ol dir, ol menu, ol dl, dir ul, dir ol, dir dir, dir menu, dir dl, menu ul, menu ol, menu dir, menu menu, menu dl, dl ul, dl ol, dl dir, dl menu, dl dl
90 | {
91 | margin-top: 0;
92 | margin-bottom: 0;
93 | }
94 |
95 | ol ul, ul ul, menu ul, dir ul, ol menu, ul menu, menu menu, dir menu, ol dir, ul dir, menu dir, dir dir
96 | {
97 | list-style-type: circle;
98 | }
99 |
100 | ol ol ul, ol ul ul, ol menu ul, ol dir ul, ol ol menu, ol ul menu, ol menu menu, ol dir menu, ol ol dir, ol ul dir, ol menu dir, ol dir dir, ul ol ul, ul ul ul, ul menu ul, ul dir ul, ul ol menu, ul ul menu, ul menu menu, ul dir menu, ul ol dir, ul ul dir, ul menu dir, ul dir dir, menu ol ul, menu ul ul, menu menu ul, menu dir ul, menu ol menu, menu ul menu, menu menu menu, menu dir menu, menu ol dir, menu ul dir, menu menu dir, menu dir dir, dir ol ul, dir ul ul, dir menu ul, dir dir ul, dir ol menu, dir ul menu, dir menu menu, dir dir menu, dir ol dir, dir ul dir, dir menu dir, dir dir dir
101 | {
102 | list-style-type: square;
103 | }
104 |
105 | .hidden
106 | {
107 | display: none;
108 | }
109 |
110 | p
111 | {
112 | line-height: 1.5em;
113 | }
114 |
115 | h1
116 | {
117 | font-size: 1.75em;
118 | line-height: 1.7em;
119 | font-family: helvetica, verdana;
120 | }
121 |
122 | h2
123 | {
124 | font-size: 1.5em;
125 | line-height: 1.7em;
126 | font-family: helvetica, verdana;
127 | }
128 |
129 | h3
130 | {
131 | font-size: 1.25em;
132 | line-height: 1.7em;
133 | font-family: helvetica, verdana;
134 | }
135 |
136 | h4
137 | {
138 | font-size: 1em;
139 | line-height: 1.7em;
140 | font-family: helvetica, verdana;
141 | }
142 |
143 | html, body
144 | {
145 | width: 100%;
146 | height: 100%;
147 | }
148 |
149 | body
150 | {
151 | margin: 0;
152 | padding: 0;
153 | background-color: #fff;
154 | position: relative;
155 | font: 16px/24px NobileRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
156 | }
157 |
158 | a
159 | {
160 | color: #1b61d6;
161 | text-decoration: none;
162 | }
163 |
164 | a:hover
165 | {
166 | color: #e88f00;
167 | text-decoration: underline;
168 | }
169 |
170 | body h1, body h2, body h3, body h4, body h5, body h6
171 | {
172 | font-family: NeutonRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
173 | font-weight: 400;
174 | color: #373839;
175 | font-style: normal;
176 | }
177 |
178 | #wrap
179 | {
180 | min-height: 100%;
181 | }
182 |
183 | #header, #footer
184 | {
185 | width: 100%;
186 | color: #fff;
187 | height: 40px;
188 | position: absolute;
189 | text-align: center;
190 | line-height: 40px;
191 | overflow: hidden;
192 | font-size: 12px;
193 | vertical-align: middle;
194 | }
195 |
196 | #header
197 | {
198 | background: #000;
199 | top: 0;
200 | font-size: 14px;
201 | }
202 |
203 | #footer
204 | {
205 | bottom: 0;
206 | background: #000 url(footerbg.png) repeat-x 0 top;
207 | position: relative;
208 | margin-top: -40px;
209 | clear: both;
210 | }
211 |
212 | .header, .footer
213 | {
214 | width: 750px;
215 | margin-right: auto;
216 | margin-left: auto;
217 | }
218 |
219 | .wrapper
220 | {
221 | width: 100%;
222 | }
223 |
224 | #top, #top-small, #bottom
225 | {
226 | width: 100%;
227 | }
228 |
229 | #top
230 | {
231 | color: #000;
232 | height: 230px;
233 | background: #fff url(headerbg.png) repeat-x 0 top;
234 | position: relative;
235 | }
236 |
237 | #top-small
238 | {
239 | color: #000;
240 | height: 60px;
241 | background: #fff url(headerbg.png) repeat-x 0 top;
242 | position: relative;
243 | }
244 |
245 | #bottom
246 | {
247 | color: #222;
248 | background-color: #fff;
249 | }
250 |
251 | .top, .top-small, .middle, .bottom
252 | {
253 | width: 750px;
254 | margin-right: auto;
255 | margin-left: auto;
256 | }
257 |
258 | .top
259 | {
260 | padding-top: 40px;
261 | }
262 |
263 | .top-small
264 | {
265 | padding-top: 10px;
266 | }
267 |
268 | #middle
269 | {
270 | width: 100%;
271 | height: 100px;
272 | background: url(middlebg.png) repeat-x;
273 | border-top: 2px solid #fff;
274 | border-bottom: 2px solid #b2b2b2;
275 | }
276 |
277 | .app-welcome
278 | {
279 | margin-top: 25px;
280 | }
281 |
282 | .app-name
283 | {
284 | color: #000;
285 | font-weight: 700;
286 | }
287 |
288 | .bottom
289 | {
290 | padding-top: 50px;
291 | }
292 |
293 | #left
294 | {
295 | width: 350px;
296 | float: left;
297 | padding-right: 25px;
298 | }
299 |
300 | #right
301 | {
302 | width: 350px;
303 | float: right;
304 | padding-left: 25px;
305 | }
306 |
307 | .align-left
308 | {
309 | text-align: left;
310 | }
311 |
312 | .align-right
313 | {
314 | text-align: right;
315 | }
316 |
317 | .align-center
318 | {
319 | text-align: center;
320 | }
321 |
322 | ul.links
323 | {
324 | margin: 0;
325 | padding: 0;
326 | }
327 |
328 | ul.links li
329 | {
330 | list-style-type: none;
331 | font-size: 14px;
332 | }
333 |
334 | form
335 | {
336 | border-style: none;
337 | }
338 |
339 | fieldset
340 | {
341 | border-style: none;
342 | }
343 |
344 | input
345 | {
346 | color: #222;
347 | border: 1px solid #ccc;
348 | font-family: sans-serif;
349 | font-size: 12px;
350 | line-height: 16px;
351 | }
352 |
353 | input[type=text], input[type=password]
354 | {
355 | width: 205px;
356 | }
357 |
358 | input[type=submit]
359 | {
360 | background-color: #ddd;
361 | font-weight: 700;
362 | }
363 |
364 | /*Opera Fix*/
365 | body:before
366 | {
367 | content: "";
368 | height: 100%;
369 | float: left;
370 | width: 0;
371 | margin-top: -32767px;
372 | }
373 |
--------------------------------------------------------------------------------
/lib/evernote/edam/userstore/UserStore-remote:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # Autogenerated by Thrift Compiler (0.11.0)
4 | #
5 | # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
6 | #
7 | # options string: py:new_style
8 | #
9 |
10 | import sys
11 | import pprint
12 | if sys.version_info[0] > 2:
13 | from urllib.parse import urlparse
14 | else:
15 | from urlparse import urlparse
16 | from thrift.transport import TTransport, TSocket, TSSLSocket, THttpClient
17 | from thrift.protocol.TBinaryProtocol import TBinaryProtocol
18 |
19 | from evernote.edam.userstore import UserStore
20 | from evernote.edam.userstore.ttypes import *
21 |
22 | if len(sys.argv) <= 1 or sys.argv[1] == '--help':
23 | print('')
24 | print('Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] [-novalidate] [-ca_certs certs] [-keyfile keyfile] [-certfile certfile] function [arg1 [arg2...]]')
25 | print('')
26 | print('Functions:')
27 | print(' bool checkVersion(string clientName, i16 edamVersionMajor, i16 edamVersionMinor)')
28 | print(' BootstrapInfo getBootstrapInfo(string locale)')
29 | print(' AuthenticationResult authenticateLongSession(string username, string password, string consumerKey, string consumerSecret, string deviceIdentifier, string deviceDescription, bool supportsTwoFactor)')
30 | print(' AuthenticationResult completeTwoFactorAuthentication(string authenticationToken, string oneTimeCode, string deviceIdentifier, string deviceDescription)')
31 | print(' void revokeLongSession(string authenticationToken)')
32 | print(' AuthenticationResult authenticateToBusiness(string authenticationToken)')
33 | print(' User getUser(string authenticationToken)')
34 | print(' PublicUserInfo getPublicUserInfo(string username)')
35 | print(' UserUrls getUserUrls(string authenticationToken)')
36 | print(' void inviteToBusiness(string authenticationToken, string emailAddress)')
37 | print(' void removeFromBusiness(string authenticationToken, string emailAddress)')
38 | print(' void updateBusinessUserIdentifier(string authenticationToken, string oldEmailAddress, string newEmailAddress)')
39 | print(' listBusinessUsers(string authenticationToken)')
40 | print(' listBusinessInvitations(string authenticationToken, bool includeRequestedInvitations)')
41 | print(' AccountLimits getAccountLimits(ServiceLevel serviceLevel)')
42 | print('')
43 | sys.exit(0)
44 |
45 | pp = pprint.PrettyPrinter(indent=2)
46 | host = 'localhost'
47 | port = 9090
48 | uri = ''
49 | framed = False
50 | ssl = False
51 | validate = True
52 | ca_certs = None
53 | keyfile = None
54 | certfile = None
55 | http = False
56 | argi = 1
57 |
58 | if sys.argv[argi] == '-h':
59 | parts = sys.argv[argi + 1].split(':')
60 | host = parts[0]
61 | if len(parts) > 1:
62 | port = int(parts[1])
63 | argi += 2
64 |
65 | if sys.argv[argi] == '-u':
66 | url = urlparse(sys.argv[argi + 1])
67 | parts = url[1].split(':')
68 | host = parts[0]
69 | if len(parts) > 1:
70 | port = int(parts[1])
71 | else:
72 | port = 80
73 | uri = url[2]
74 | if url[4]:
75 | uri += '?%s' % url[4]
76 | http = True
77 | argi += 2
78 |
79 | if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
80 | framed = True
81 | argi += 1
82 |
83 | if sys.argv[argi] == '-s' or sys.argv[argi] == '-ssl':
84 | ssl = True
85 | argi += 1
86 |
87 | if sys.argv[argi] == '-novalidate':
88 | validate = False
89 | argi += 1
90 |
91 | if sys.argv[argi] == '-ca_certs':
92 | ca_certs = sys.argv[argi+1]
93 | argi += 2
94 |
95 | if sys.argv[argi] == '-keyfile':
96 | keyfile = sys.argv[argi+1]
97 | argi += 2
98 |
99 | if sys.argv[argi] == '-certfile':
100 | certfile = sys.argv[argi+1]
101 | argi += 2
102 |
103 | cmd = sys.argv[argi]
104 | args = sys.argv[argi + 1:]
105 |
106 | if http:
107 | transport = THttpClient.THttpClient(host, port, uri)
108 | else:
109 | if ssl:
110 | socket = TSSLSocket.TSSLSocket(host, port, validate=validate, ca_certs=ca_certs, keyfile=keyfile, certfile=certfile)
111 | else:
112 | socket = TSocket.TSocket(host, port)
113 | if framed:
114 | transport = TTransport.TFramedTransport(socket)
115 | else:
116 | transport = TTransport.TBufferedTransport(socket)
117 | protocol = TBinaryProtocol(transport)
118 | client = UserStore.Client(protocol)
119 | transport.open()
120 |
121 | if cmd == 'checkVersion':
122 | if len(args) != 3:
123 | print('checkVersion requires 3 args')
124 | sys.exit(1)
125 | pp.pprint(client.checkVersion(args[0], eval(args[1]), eval(args[2]),))
126 |
127 | elif cmd == 'getBootstrapInfo':
128 | if len(args) != 1:
129 | print('getBootstrapInfo requires 1 args')
130 | sys.exit(1)
131 | pp.pprint(client.getBootstrapInfo(args[0],))
132 |
133 | elif cmd == 'authenticateLongSession':
134 | if len(args) != 7:
135 | print('authenticateLongSession requires 7 args')
136 | sys.exit(1)
137 | pp.pprint(client.authenticateLongSession(args[0], args[1], args[2], args[3], args[4], args[5], eval(args[6]),))
138 |
139 | elif cmd == 'completeTwoFactorAuthentication':
140 | if len(args) != 4:
141 | print('completeTwoFactorAuthentication requires 4 args')
142 | sys.exit(1)
143 | pp.pprint(client.completeTwoFactorAuthentication(args[0], args[1], args[2], args[3],))
144 |
145 | elif cmd == 'revokeLongSession':
146 | if len(args) != 1:
147 | print('revokeLongSession requires 1 args')
148 | sys.exit(1)
149 | pp.pprint(client.revokeLongSession(args[0],))
150 |
151 | elif cmd == 'authenticateToBusiness':
152 | if len(args) != 1:
153 | print('authenticateToBusiness requires 1 args')
154 | sys.exit(1)
155 | pp.pprint(client.authenticateToBusiness(args[0],))
156 |
157 | elif cmd == 'getUser':
158 | if len(args) != 1:
159 | print('getUser requires 1 args')
160 | sys.exit(1)
161 | pp.pprint(client.getUser(args[0],))
162 |
163 | elif cmd == 'getPublicUserInfo':
164 | if len(args) != 1:
165 | print('getPublicUserInfo requires 1 args')
166 | sys.exit(1)
167 | pp.pprint(client.getPublicUserInfo(args[0],))
168 |
169 | elif cmd == 'getUserUrls':
170 | if len(args) != 1:
171 | print('getUserUrls requires 1 args')
172 | sys.exit(1)
173 | pp.pprint(client.getUserUrls(args[0],))
174 |
175 | elif cmd == 'inviteToBusiness':
176 | if len(args) != 2:
177 | print('inviteToBusiness requires 2 args')
178 | sys.exit(1)
179 | pp.pprint(client.inviteToBusiness(args[0], args[1],))
180 |
181 | elif cmd == 'removeFromBusiness':
182 | if len(args) != 2:
183 | print('removeFromBusiness requires 2 args')
184 | sys.exit(1)
185 | pp.pprint(client.removeFromBusiness(args[0], args[1],))
186 |
187 | elif cmd == 'updateBusinessUserIdentifier':
188 | if len(args) != 3:
189 | print('updateBusinessUserIdentifier requires 3 args')
190 | sys.exit(1)
191 | pp.pprint(client.updateBusinessUserIdentifier(args[0], args[1], args[2],))
192 |
193 | elif cmd == 'listBusinessUsers':
194 | if len(args) != 1:
195 | print('listBusinessUsers requires 1 args')
196 | sys.exit(1)
197 | pp.pprint(client.listBusinessUsers(args[0],))
198 |
199 | elif cmd == 'listBusinessInvitations':
200 | if len(args) != 2:
201 | print('listBusinessInvitations requires 2 args')
202 | sys.exit(1)
203 | pp.pprint(client.listBusinessInvitations(args[0], eval(args[1]),))
204 |
205 | elif cmd == 'getAccountLimits':
206 | if len(args) != 1:
207 | print('getAccountLimits requires 1 args')
208 | sys.exit(1)
209 | pp.pprint(client.getAccountLimits(eval(args[0]),))
210 |
211 | else:
212 | print('Unrecognized method %s' % cmd)
213 | sys.exit(1)
214 |
215 | transport.close()
216 |
--------------------------------------------------------------------------------
/lib/evernote/edam/limits/constants.py:
--------------------------------------------------------------------------------
1 | #
2 | # Autogenerated by Thrift Compiler (0.11.0)
3 | #
4 | # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5 | #
6 | # options string: py:new_style
7 | #
8 |
9 | from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
10 | from thrift.protocol.TProtocol import TProtocolException
11 | from thrift.TRecursive import fix_spec
12 |
13 | import sys
14 | from .ttypes import *
15 | EDAM_ATTRIBUTE_LEN_MIN = 1
16 | EDAM_ATTRIBUTE_LEN_MAX = 4096
17 | EDAM_ATTRIBUTE_REGEX = "^[^\\p{Cc}\\p{Zl}\\p{Zp}]{1,4096}$"
18 | EDAM_ATTRIBUTE_LIST_MAX = 100
19 | EDAM_ATTRIBUTE_MAP_MAX = 100
20 | EDAM_GUID_LEN_MIN = 36
21 | EDAM_GUID_LEN_MAX = 36
22 | EDAM_GUID_REGEX = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
23 | EDAM_EMAIL_LEN_MIN = 6
24 | EDAM_EMAIL_LEN_MAX = 255
25 | EDAM_EMAIL_LOCAL_REGEX = "^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*$"
26 | EDAM_EMAIL_DOMAIN_REGEX = "^[A-Za-z0-9-]*[A-Za-z0-9](\\.[A-Za-z0-9-]*[A-Za-z0-9])*\\.([A-Za-z]{2,})$"
27 | EDAM_EMAIL_REGEX = "^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@[A-Za-z0-9-]*[A-Za-z0-9](\\.[A-Za-z0-9-]*[A-Za-z0-9])*\\.([A-Za-z]{2,})$"
28 | EDAM_VAT_REGEX = "^(AT)?U[0-9]{8}$|^(BE)?0?[0-9]{9}$|^(BG)?[0-9]{9,10}$|^(CY)?[0-9]{8}L$|^(CZ)?[0-9]{8,10}$|^(DE)?[0-9]{9}$|^(DK)?[0-9]{8}$|^(EE)?[0-9]{9}$|^(EL|GR)?[0-9]{9}$|^(ES)?[0-9A-Z][0-9]{7}[0-9A-Z]$|^(FI)?[0-9]{8}$|^(FR)?[0-9A-Z]{2}[0-9]{9}$|^(GB)?([0-9]{9}([0-9]{3})?|[A-Z]{2}[0-9]{3})$|^(HU)?[0-9]{8}$|^(IE)?[0-9]S[0-9]{5}L$|^(IT)?[0-9]{11}$|^(LT)?([0-9]{9}|[0-9]{12})$|^(LU)?[0-9]{8}$|^(LV)?[0-9]{11}$|^(MT)?[0-9]{8}$|^(NL)?[0-9]{9}B[0-9]{2}$|^(PL)?[0-9]{10}$|^(PT)?[0-9]{9}$|^(RO)?[0-9]{2,10}$|^(SE)?[0-9]{12}$|^(SI)?[0-9]{8}$|^(SK)?[0-9]{10}$|^[0-9]{9}MVA$|^[0-9]{6}$|^CHE[0-9]{9}(TVA|MWST|IVA)$"
29 | EDAM_TIMEZONE_LEN_MIN = 1
30 | EDAM_TIMEZONE_LEN_MAX = 32
31 | EDAM_TIMEZONE_REGEX = "^([A-Za-z_-]+(/[A-Za-z_-]+)*)|(GMT(-|\\+)[0-9]{1,2}(:[0-9]{2})?)$"
32 | EDAM_MIME_LEN_MIN = 3
33 | EDAM_MIME_LEN_MAX = 255
34 | EDAM_MIME_REGEX = "^[A-Za-z]+/[A-Za-z0-9._+-]+$"
35 | EDAM_MIME_TYPE_GIF = "image/gif"
36 | EDAM_MIME_TYPE_JPEG = "image/jpeg"
37 | EDAM_MIME_TYPE_PNG = "image/png"
38 | EDAM_MIME_TYPE_TIFF = "image/tiff"
39 | EDAM_MIME_TYPE_WAV = "audio/wav"
40 | EDAM_MIME_TYPE_MP3 = "audio/mpeg"
41 | EDAM_MIME_TYPE_AMR = "audio/amr"
42 | EDAM_MIME_TYPE_AAC = "audio/aac"
43 | EDAM_MIME_TYPE_M4A = "audio/mp4"
44 | EDAM_MIME_TYPE_MP4_VIDEO = "video/mp4"
45 | EDAM_MIME_TYPE_INK = "application/vnd.evernote.ink"
46 | EDAM_MIME_TYPE_PDF = "application/pdf"
47 | EDAM_MIME_TYPE_DEFAULT = "application/octet-stream"
48 | EDAM_MIME_TYPES = set((
49 | "image/gif",
50 | "image/jpeg",
51 | "image/png",
52 | "audio/wav",
53 | "audio/mpeg",
54 | "audio/amr",
55 | "application/vnd.evernote.ink",
56 | "application/pdf",
57 | "video/mp4",
58 | "audio/aac",
59 | "audio/mp4",
60 | ))
61 | EDAM_INDEXABLE_RESOURCE_MIME_TYPES = set((
62 | "application/msword",
63 | "application/mspowerpoint",
64 | "application/excel",
65 | "application/vnd.ms-word",
66 | "application/vnd.ms-powerpoint",
67 | "application/vnd.ms-excel",
68 | "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
69 | "application/vnd.openxmlformats-officedocument.presentationml.presentation",
70 | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
71 | "application/vnd.apple.pages",
72 | "application/vnd.apple.numbers",
73 | "application/vnd.apple.keynote",
74 | "application/x-iwork-pages-sffpages",
75 | "application/x-iwork-numbers-sffnumbers",
76 | "application/x-iwork-keynote-sffkey",
77 | ))
78 | EDAM_INDEXABLE_PLAINTEXT_MIME_TYPES = set((
79 | "application/x-sh",
80 | "application/x-bsh",
81 | "application/sql",
82 | "application/x-sql",
83 | ))
84 | EDAM_SEARCH_QUERY_LEN_MIN = 0
85 | EDAM_SEARCH_QUERY_LEN_MAX = 1024
86 | EDAM_SEARCH_QUERY_REGEX = "^[^\\p{Cc}\\p{Zl}\\p{Zp}]{0,1024}$"
87 | EDAM_HASH_LEN = 16
88 | EDAM_USER_USERNAME_LEN_MIN = 1
89 | EDAM_USER_USERNAME_LEN_MAX = 64
90 | EDAM_USER_USERNAME_REGEX = "^[a-z0-9]([a-z0-9_-]{0,62}[a-z0-9])?$"
91 | EDAM_USER_NAME_LEN_MIN = 1
92 | EDAM_USER_NAME_LEN_MAX = 255
93 | EDAM_USER_NAME_REGEX = "^[^\\p{Cc}\\p{Zl}\\p{Zp}]{1,255}$"
94 | EDAM_TAG_NAME_LEN_MIN = 1
95 | EDAM_TAG_NAME_LEN_MAX = 100
96 | EDAM_TAG_NAME_REGEX = "^[^,\\p{Cc}\\p{Z}]([^,\\p{Cc}\\p{Zl}\\p{Zp}]{0,98}[^,\\p{Cc}\\p{Z}])?$"
97 | EDAM_NOTE_TITLE_LEN_MIN = 1
98 | EDAM_NOTE_TITLE_LEN_MAX = 255
99 | EDAM_NOTE_TITLE_REGEX = "^[^\\p{Cc}\\p{Z}]([^\\p{Cc}\\p{Zl}\\p{Zp}]{0,253}[^\\p{Cc}\\p{Z}])?$"
100 | EDAM_NOTE_CONTENT_LEN_MIN = 0
101 | EDAM_NOTE_CONTENT_LEN_MAX = 5242880
102 | EDAM_APPLICATIONDATA_NAME_LEN_MIN = 3
103 | EDAM_APPLICATIONDATA_NAME_LEN_MAX = 32
104 | EDAM_APPLICATIONDATA_VALUE_LEN_MIN = 0
105 | EDAM_APPLICATIONDATA_VALUE_LEN_MAX = 4092
106 | EDAM_APPLICATIONDATA_ENTRY_LEN_MAX = 4095
107 | EDAM_APPLICATIONDATA_NAME_REGEX = "^[A-Za-z0-9_.-]{3,32}$"
108 | EDAM_APPLICATIONDATA_VALUE_REGEX = "^[\\p{Space}[^\\p{Cc}]]{0,4092}$"
109 | EDAM_NOTEBOOK_NAME_LEN_MIN = 1
110 | EDAM_NOTEBOOK_NAME_LEN_MAX = 100
111 | EDAM_NOTEBOOK_NAME_REGEX = "^[^\\p{Cc}\\p{Z}]([^\\p{Cc}\\p{Zl}\\p{Zp}]{0,98}[^\\p{Cc}\\p{Z}])?$"
112 | EDAM_NOTEBOOK_STACK_LEN_MIN = 1
113 | EDAM_NOTEBOOK_STACK_LEN_MAX = 100
114 | EDAM_NOTEBOOK_STACK_REGEX = "^[^\\p{Cc}\\p{Z}]([^\\p{Cc}\\p{Zl}\\p{Zp}]{0,98}[^\\p{Cc}\\p{Z}])?$"
115 | EDAM_PUBLISHING_URI_LEN_MIN = 1
116 | EDAM_PUBLISHING_URI_LEN_MAX = 255
117 | EDAM_PUBLISHING_URI_REGEX = "^[a-zA-Z0-9.~_+-]{1,255}$"
118 | EDAM_PUBLISHING_URI_PROHIBITED = set((
119 | ".",
120 | "..",
121 | ))
122 | EDAM_PUBLISHING_DESCRIPTION_LEN_MIN = 1
123 | EDAM_PUBLISHING_DESCRIPTION_LEN_MAX = 200
124 | EDAM_PUBLISHING_DESCRIPTION_REGEX = "^[^\\p{Cc}\\p{Z}]([^\\p{Cc}\\p{Zl}\\p{Zp}]{0,198}[^\\p{Cc}\\p{Z}])?$"
125 | EDAM_SAVED_SEARCH_NAME_LEN_MIN = 1
126 | EDAM_SAVED_SEARCH_NAME_LEN_MAX = 100
127 | EDAM_SAVED_SEARCH_NAME_REGEX = "^[^\\p{Cc}\\p{Z}]([^\\p{Cc}\\p{Zl}\\p{Zp}]{0,98}[^\\p{Cc}\\p{Z}])?$"
128 | EDAM_USER_PASSWORD_LEN_MIN = 6
129 | EDAM_USER_PASSWORD_LEN_MAX = 64
130 | EDAM_USER_PASSWORD_REGEX = "^[A-Za-z0-9!#$%&'()*+,./:;<=>?@^_`{|}~\\[\\]\\\\-]{6,64}$"
131 | EDAM_BUSINESS_URI_LEN_MAX = 32
132 | EDAM_NOTE_TAGS_MAX = 100
133 | EDAM_NOTE_RESOURCES_MAX = 1000
134 | EDAM_USER_TAGS_MAX = 100000
135 | EDAM_BUSINESS_TAGS_MAX = 100000
136 | EDAM_USER_SAVED_SEARCHES_MAX = 100
137 | EDAM_USER_NOTES_MAX = 100000
138 | EDAM_BUSINESS_NOTES_MAX = 500000
139 | EDAM_USER_NOTEBOOKS_MAX = 250
140 | EDAM_BUSINESS_NOTEBOOKS_MAX = 10000
141 | EDAM_USER_RECENT_MAILED_ADDRESSES_MAX = 10
142 | EDAM_USER_MAIL_LIMIT_DAILY_FREE = 50
143 | EDAM_USER_MAIL_LIMIT_DAILY_PREMIUM = 200
144 | EDAM_USER_UPLOAD_LIMIT_FREE = 62914560
145 | EDAM_USER_UPLOAD_LIMIT_PREMIUM = 10737418240
146 | EDAM_USER_UPLOAD_LIMIT_PLUS = 1073741824
147 | EDAM_USER_UPLOAD_SURVEY_THRESHOLD = 5368709120
148 | EDAM_USER_UPLOAD_LIMIT_BUSINESS = 10737418240
149 | EDAM_USER_UPLOAD_LIMIT_BUSINESS_PER_USER = 2147483647
150 | EDAM_NOTE_SIZE_MAX_FREE = 26214400
151 | EDAM_NOTE_SIZE_MAX_PREMIUM = 209715200
152 | EDAM_RESOURCE_SIZE_MAX_FREE = 26214400
153 | EDAM_RESOURCE_SIZE_MAX_PREMIUM = 209715200
154 | EDAM_USER_LINKED_NOTEBOOK_MAX = 100
155 | EDAM_USER_LINKED_NOTEBOOK_MAX_PREMIUM = 500
156 | EDAM_NOTEBOOK_BUSINESS_SHARED_NOTEBOOK_MAX = 5000
157 | EDAM_NOTEBOOK_PERSONAL_SHARED_NOTEBOOK_MAX = 500
158 | EDAM_NOTE_BUSINESS_SHARED_NOTE_MAX = 1000
159 | EDAM_NOTE_PERSONAL_SHARED_NOTE_MAX = 100
160 | EDAM_NOTE_CONTENT_CLASS_LEN_MIN = 3
161 | EDAM_NOTE_CONTENT_CLASS_LEN_MAX = 32
162 | EDAM_NOTE_CONTENT_CLASS_REGEX = "^[A-Za-z0-9_.-]{3,32}$"
163 | EDAM_HELLO_APP_CONTENT_CLASS_PREFIX = "evernote.hello."
164 | EDAM_FOOD_APP_CONTENT_CLASS_PREFIX = "evernote.food."
165 | EDAM_CONTENT_CLASS_HELLO_ENCOUNTER = "evernote.hello.encounter"
166 | EDAM_CONTENT_CLASS_HELLO_PROFILE = "evernote.hello.profile"
167 | EDAM_CONTENT_CLASS_FOOD_MEAL = "evernote.food.meal"
168 | EDAM_CONTENT_CLASS_SKITCH_PREFIX = "evernote.skitch"
169 | EDAM_CONTENT_CLASS_SKITCH = "evernote.skitch"
170 | EDAM_CONTENT_CLASS_SKITCH_PDF = "evernote.skitch.pdf"
171 | EDAM_CONTENT_CLASS_PENULTIMATE_PREFIX = "evernote.penultimate."
172 | EDAM_CONTENT_CLASS_PENULTIMATE_NOTEBOOK = "evernote.penultimate.notebook"
173 | EDAM_SOURCE_APPLICATION_POSTIT = "postit"
174 | EDAM_SOURCE_APPLICATION_MOLESKINE = "moleskine"
175 | EDAM_SOURCE_APPLICATION_EN_SCANSNAP = "scanner.scansnap.evernote"
176 | EDAM_SOURCE_APPLICATION_EWC = "clipncite.web"
177 | EDAM_SOURCE_OUTLOOK_CLIPPER = "app.ms.outlook"
178 | EDAM_NOTE_TITLE_QUALITY_UNTITLED = 0
179 | EDAM_NOTE_TITLE_QUALITY_LOW = 1
180 | EDAM_NOTE_TITLE_QUALITY_MEDIUM = 2
181 | EDAM_NOTE_TITLE_QUALITY_HIGH = 3
182 | EDAM_RELATED_PLAINTEXT_LEN_MIN = 1
183 | EDAM_RELATED_PLAINTEXT_LEN_MAX = 131072
184 | EDAM_RELATED_MAX_NOTES = 25
185 | EDAM_RELATED_MAX_NOTEBOOKS = 1
186 | EDAM_RELATED_MAX_TAGS = 25
187 | EDAM_RELATED_MAX_EXPERTS = 10
188 | EDAM_RELATED_MAX_RELATED_CONTENT = 10
189 | EDAM_BUSINESS_NOTEBOOK_DESCRIPTION_LEN_MIN = 1
190 | EDAM_BUSINESS_NOTEBOOK_DESCRIPTION_LEN_MAX = 200
191 | EDAM_BUSINESS_NOTEBOOK_DESCRIPTION_REGEX = "^[^\\p{Cc}\\p{Z}]([^\\p{Cc}\\p{Zl}\\p{Zp}]{0,198}[^\\p{Cc}\\p{Z}])?$"
192 | EDAM_BUSINESS_PHONE_NUMBER_LEN_MAX = 20
193 | EDAM_PREFERENCE_NAME_LEN_MIN = 3
194 | EDAM_PREFERENCE_NAME_LEN_MAX = 32
195 | EDAM_PREFERENCE_VALUE_LEN_MIN = 1
196 | EDAM_PREFERENCE_VALUE_LEN_MAX = 1024
197 | EDAM_MAX_PREFERENCES = 100
198 | EDAM_MAX_VALUES_PER_PREFERENCE = 256
199 | EDAM_PREFERENCE_ONLY_ONE_VALUE_LEN_MAX = 16384
200 | EDAM_PREFERENCE_NAME_REGEX = "^[A-Za-z0-9_.-]{3,32}$"
201 | EDAM_PREFERENCE_VALUE_REGEX = "^[^\\p{Cc}]{1,1024}$"
202 | EDAM_PREFERENCE_ONLY_ONE_VALUE_REGEX = "^[^\\p{Cc}]{1,16384}$"
203 | EDAM_PREFERENCE_SHORTCUTS = "evernote.shortcuts"
204 | EDAM_PREFERENCE_BUSINESS_DEFAULT_NOTEBOOK = "evernote.business.notebook"
205 | EDAM_PREFERENCE_BUSINESS_QUICKNOTE = "evernote.business.quicknote"
206 | EDAM_PREFERENCE_SHORTCUTS_MAX_VALUES = 250
207 | EDAM_DEVICE_ID_LEN_MAX = 32
208 | EDAM_DEVICE_ID_REGEX = "^[^\\p{Cc}]{1,32}$"
209 | EDAM_DEVICE_DESCRIPTION_LEN_MAX = 64
210 | EDAM_DEVICE_DESCRIPTION_REGEX = "^[^\\p{Cc}]{1,64}$"
211 | EDAM_SEARCH_SUGGESTIONS_MAX = 10
212 | EDAM_SEARCH_SUGGESTIONS_PREFIX_LEN_MAX = 1024
213 | EDAM_SEARCH_SUGGESTIONS_PREFIX_LEN_MIN = 2
214 | EDAM_FIND_CONTACT_DEFAULT_MAX_RESULTS = 100
215 | EDAM_FIND_CONTACT_MAX_RESULTS = 256
216 | EDAM_NOTE_LOCK_VIEWERS_NOTES_MAX = 150
217 | EDAM_MESSAGE_BODY_LEN_MAX = 2048
218 | EDAM_MESSAGE_BODY_REGEX = "^[^\\p{Cc}\\p{Z}]([^\\p{Cc}\\p{Zl}\\p{Zp}]{0,2046}[^\\p{Cc}\\p{Z}])?$"
219 | EDAM_MESSAGE_RECIPIENTS_MAX = 50
220 | EDAM_MESSAGE_ATTACHMENTS_MAX = 100
221 | EDAM_MESSAGE_ATTACHMENT_TITLE_LEN_MAX = 255
222 | EDAM_MESSAGE_ATTACHMENT_TITLE_REGEX = "^[^\\p{Cc}\\p{Z}]([^\\p{Cc}\\p{Zl}\\p{Zp}]{0,253}[^\\p{Cc}\\p{Z}])?$"
223 | EDAM_MESSAGE_ATTACHMENT_SNIPPET_LEN_MAX = 2048
224 | EDAM_MESSAGE_ATTACHMENT_SNIPPET_REGEX = "^[^\\p{Cc}\\p{Z}]([\\n[^\\p{Cc}\\p{Zl}\\p{Zp}]]{0,2046}[^\\p{Cc}\\p{Z}])?$"
225 | EDAM_USER_PROFILE_PHOTO_MAX_BYTES = 716800
226 | EDAM_PROMOTION_ID_LEN_MAX = 32
227 | EDAM_PROMOTION_ID_REGEX = "^[A-Za-z0-9_.-]{1,32}$"
228 | EDAM_APP_RATING_MIN = 1
229 | EDAM_APP_RATING_MAX = 5
230 | EDAM_SNIPPETS_NOTES_MAX = 24
231 | EDAM_CONNECTED_IDENTITY_REQUEST_MAX = 100
232 |
--------------------------------------------------------------------------------
/APACHE-LICENSE-2.0.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/lib/evernote/edam/error/ttypes.py:
--------------------------------------------------------------------------------
1 | #
2 | # Autogenerated by Thrift Compiler (0.11.0)
3 | #
4 | # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5 | #
6 | # options string: py:new_style
7 | #
8 |
9 | from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
10 | from thrift.protocol.TProtocol import TProtocolException
11 | from thrift.TRecursive import fix_spec
12 |
13 | import sys
14 | import evernote.edam.type.ttypes
15 |
16 | from thrift.transport import TTransport
17 | all_structs = []
18 |
19 |
20 | class EDAMErrorCode(object):
21 | """
22 | Numeric codes indicating the type of error that occurred on the
23 | service.
24 |
25 | - UNKNOWN
26 | - No information available about the error
27 | - BAD_DATA_FORMAT
28 | - The format of the request data was incorrect
29 | - PERMISSION_DENIED
30 | - Not permitted to perform action
31 | - INTERNAL_ERROR
32 | - Unexpected problem with the service
33 | - DATA_REQUIRED
34 | - A required parameter/field was absent
35 | - LIMIT_REACHED
36 | - Operation denied due to data model limit
37 | - QUOTA_REACHED
38 | - Operation denied due to user storage limit
39 | - INVALID_AUTH
40 | - Username and/or password incorrect
41 | - AUTH_EXPIRED
42 | - Authentication token expired
43 | - DATA_CONFLICT
44 | - Change denied due to data model conflict
45 | - ENML_VALIDATION
46 | - Content of submitted note was malformed
47 | - SHARD_UNAVAILABLE
48 | - Service shard with account data is temporarily down
49 | - LEN_TOO_SHORT
50 | - Operation denied due to data model limit, where something such
51 | as a string length was too short
52 | - LEN_TOO_LONG
53 | - Operation denied due to data model limit, where something such
54 | as a string length was too long
55 | - TOO_FEW
56 | - Operation denied due to data model limit, where there were
57 | too few of something.
58 | - TOO_MANY
59 | - Operation denied due to data model limit, where there were
60 | too many of something.
61 | - UNSUPPORTED_OPERATION
62 | - Operation denied because it is currently unsupported.
63 | - TAKEN_DOWN
64 | - Operation denied because access to the corresponding object is
65 | prohibited in response to a take-down notice.
66 | - RATE_LIMIT_REACHED
67 | - Operation denied because the calling application has reached
68 | its hourly API call limit for this user.
69 | - BUSINESS_SECURITY_LOGIN_REQUIRED
70 | - Access to a business account has been denied because the user must complete
71 | additional steps in order to comply with business security requirements.
72 | - DEVICE_LIMIT_REACHED
73 | - Operation denied because the user has exceeded their maximum allowed
74 | number of devices.
75 |
76 | """
77 | UNKNOWN = 1
78 | BAD_DATA_FORMAT = 2
79 | PERMISSION_DENIED = 3
80 | INTERNAL_ERROR = 4
81 | DATA_REQUIRED = 5
82 | LIMIT_REACHED = 6
83 | QUOTA_REACHED = 7
84 | INVALID_AUTH = 8
85 | AUTH_EXPIRED = 9
86 | DATA_CONFLICT = 10
87 | ENML_VALIDATION = 11
88 | SHARD_UNAVAILABLE = 12
89 | LEN_TOO_SHORT = 13
90 | LEN_TOO_LONG = 14
91 | TOO_FEW = 15
92 | TOO_MANY = 16
93 | UNSUPPORTED_OPERATION = 17
94 | TAKEN_DOWN = 18
95 | RATE_LIMIT_REACHED = 19
96 | BUSINESS_SECURITY_LOGIN_REQUIRED = 20
97 | DEVICE_LIMIT_REACHED = 21
98 |
99 | _VALUES_TO_NAMES = {
100 | 1: "UNKNOWN",
101 | 2: "BAD_DATA_FORMAT",
102 | 3: "PERMISSION_DENIED",
103 | 4: "INTERNAL_ERROR",
104 | 5: "DATA_REQUIRED",
105 | 6: "LIMIT_REACHED",
106 | 7: "QUOTA_REACHED",
107 | 8: "INVALID_AUTH",
108 | 9: "AUTH_EXPIRED",
109 | 10: "DATA_CONFLICT",
110 | 11: "ENML_VALIDATION",
111 | 12: "SHARD_UNAVAILABLE",
112 | 13: "LEN_TOO_SHORT",
113 | 14: "LEN_TOO_LONG",
114 | 15: "TOO_FEW",
115 | 16: "TOO_MANY",
116 | 17: "UNSUPPORTED_OPERATION",
117 | 18: "TAKEN_DOWN",
118 | 19: "RATE_LIMIT_REACHED",
119 | 20: "BUSINESS_SECURITY_LOGIN_REQUIRED",
120 | 21: "DEVICE_LIMIT_REACHED",
121 | }
122 |
123 | _NAMES_TO_VALUES = {
124 | "UNKNOWN": 1,
125 | "BAD_DATA_FORMAT": 2,
126 | "PERMISSION_DENIED": 3,
127 | "INTERNAL_ERROR": 4,
128 | "DATA_REQUIRED": 5,
129 | "LIMIT_REACHED": 6,
130 | "QUOTA_REACHED": 7,
131 | "INVALID_AUTH": 8,
132 | "AUTH_EXPIRED": 9,
133 | "DATA_CONFLICT": 10,
134 | "ENML_VALIDATION": 11,
135 | "SHARD_UNAVAILABLE": 12,
136 | "LEN_TOO_SHORT": 13,
137 | "LEN_TOO_LONG": 14,
138 | "TOO_FEW": 15,
139 | "TOO_MANY": 16,
140 | "UNSUPPORTED_OPERATION": 17,
141 | "TAKEN_DOWN": 18,
142 | "RATE_LIMIT_REACHED": 19,
143 | "BUSINESS_SECURITY_LOGIN_REQUIRED": 20,
144 | "DEVICE_LIMIT_REACHED": 21,
145 | }
146 |
147 |
148 | class EDAMInvalidContactReason(object):
149 | """
150 | An enumeration that provides a reason for why a given contact was invalid, for example,
151 | as thrown via an EDAMInvalidContactsException.
152 |
153 |
154 | - BAD_ADDRESS
155 | - The contact information does not represent a valid address for a recipient.
156 | Clients should be validating and normalizing contacts, so receiving this
157 | error code commonly represents a client error.
158 |
159 | - DUPLICATE_CONTACT
160 | - If the method throwing this exception accepts a list of contacts, this error
161 | code indicates that the given contact is a duplicate of another contact in
162 | the list. Note that the server may clean up contacts, and that this cleanup
163 | occurs before checking for duplication. Receiving this error is commonly
164 | an indication of a client issue, since client should be normalizing contacts
165 | and removing duplicates. All instances that are duplicates are returned. For
166 | example, if a list of 5 contacts has the same e-mail address twice, the two
167 | conflicting e-mail address contacts will be returned.
168 |
169 | - NO_CONNECTION
170 | - Indicates that the given contact, an Evernote type contact, is not connected
171 | to the user for which the call is being made. It is possible that clients are
172 | out of sync with the server and should re-synchronize their identities and
173 | business user state. See Identity.userConnected for more information on user
174 | connections.
175 |
176 |
177 |
178 | Note that if multiple reasons may apply, only one is returned. The precedence order
179 | is BAD_ADDRESS, DUPLICATE_CONTACT, NO_CONNECTION, meaning that if a contact has a bad
180 | address and is also duplicated, it will be returned as a BAD_ADDRESS.
181 | """
182 | BAD_ADDRESS = 0
183 | DUPLICATE_CONTACT = 1
184 | NO_CONNECTION = 2
185 |
186 | _VALUES_TO_NAMES = {
187 | 0: "BAD_ADDRESS",
188 | 1: "DUPLICATE_CONTACT",
189 | 2: "NO_CONNECTION",
190 | }
191 |
192 | _NAMES_TO_VALUES = {
193 | "BAD_ADDRESS": 0,
194 | "DUPLICATE_CONTACT": 1,
195 | "NO_CONNECTION": 2,
196 | }
197 |
198 |
199 | class EDAMUserException(TException):
200 | """
201 | This exception is thrown by EDAM procedures when a call fails as a result of
202 | a problem that a caller may be able to resolve. For example, if the user
203 | attempts to add a note to their account which would exceed their storage
204 | quota, this type of exception may be thrown to indicate the source of the
205 | error so that they can choose an alternate action.
206 |
207 | This exception would not be used for internal system errors that do not
208 | reflect user actions, but rather reflect a problem within the service that
209 | the user cannot resolve.
210 |
211 | errorCode: The numeric code indicating the type of error that occurred.
212 | must be one of the values of EDAMErrorCode.
213 |
214 | parameter: If the error applied to a particular input parameter, this will
215 | indicate which parameter.
216 |
217 | Attributes:
218 | - errorCode
219 | - parameter
220 | """
221 |
222 |
223 | def __init__(self, errorCode=None, parameter=None,):
224 | self.errorCode = errorCode
225 | self.parameter = parameter
226 |
227 | def read(self, iprot):
228 | if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
229 | iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
230 | return
231 | iprot.readStructBegin()
232 | while True:
233 | (fname, ftype, fid) = iprot.readFieldBegin()
234 | if ftype == TType.STOP:
235 | break
236 | if fid == 1:
237 | if ftype == TType.I32:
238 | self.errorCode = iprot.readI32()
239 | else:
240 | iprot.skip(ftype)
241 | elif fid == 2:
242 | if ftype == TType.STRING:
243 | self.parameter = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
244 | else:
245 | iprot.skip(ftype)
246 | else:
247 | iprot.skip(ftype)
248 | iprot.readFieldEnd()
249 | iprot.readStructEnd()
250 |
251 | def write(self, oprot):
252 | if oprot._fast_encode is not None and self.thrift_spec is not None:
253 | oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
254 | return
255 | oprot.writeStructBegin('EDAMUserException')
256 | if self.errorCode is not None:
257 | oprot.writeFieldBegin('errorCode', TType.I32, 1)
258 | oprot.writeI32(self.errorCode)
259 | oprot.writeFieldEnd()
260 | if self.parameter is not None:
261 | oprot.writeFieldBegin('parameter', TType.STRING, 2)
262 | oprot.writeString(self.parameter.encode('utf-8') if sys.version_info[0] == 2 else self.parameter)
263 | oprot.writeFieldEnd()
264 | oprot.writeFieldStop()
265 | oprot.writeStructEnd()
266 |
267 | def validate(self):
268 | if self.errorCode is None:
269 | raise TProtocolException(message='Required field errorCode is unset!')
270 | return
271 |
272 | def __str__(self):
273 | return repr(self)
274 |
275 | def __repr__(self):
276 | L = ['%s=%r' % (key, value)
277 | for key, value in self.__dict__.items()]
278 | return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
279 |
280 | def __eq__(self, other):
281 | return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
282 |
283 | def __ne__(self, other):
284 | return not (self == other)
285 |
286 |
287 | class EDAMSystemException(TException):
288 | """
289 | This exception is thrown by EDAM procedures when a call fails as a result of
290 | a problem in the service that could not be changed through caller action.
291 |
292 | errorCode: The numeric code indicating the type of error that occurred.
293 | must be one of the values of EDAMErrorCode.
294 |
295 | message: This may contain additional information about the error
296 |
297 | rateLimitDuration: Indicates the minimum number of seconds that an application should
298 | expect subsequent API calls for this user to fail. The application should not retry
299 | API requests for the user until at least this many seconds have passed. Present only
300 | when errorCode is RATE_LIMIT_REACHED,
301 |
302 | Attributes:
303 | - errorCode
304 | - message
305 | - rateLimitDuration
306 | """
307 |
308 |
309 | def __init__(self, errorCode=None, message=None, rateLimitDuration=None,):
310 | self.errorCode = errorCode
311 | self.message = message
312 | self.rateLimitDuration = rateLimitDuration
313 |
314 | def read(self, iprot):
315 | if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
316 | iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
317 | return
318 | iprot.readStructBegin()
319 | while True:
320 | (fname, ftype, fid) = iprot.readFieldBegin()
321 | if ftype == TType.STOP:
322 | break
323 | if fid == 1:
324 | if ftype == TType.I32:
325 | self.errorCode = iprot.readI32()
326 | else:
327 | iprot.skip(ftype)
328 | elif fid == 2:
329 | if ftype == TType.STRING:
330 | self.message = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
331 | else:
332 | iprot.skip(ftype)
333 | elif fid == 3:
334 | if ftype == TType.I32:
335 | self.rateLimitDuration = iprot.readI32()
336 | else:
337 | iprot.skip(ftype)
338 | else:
339 | iprot.skip(ftype)
340 | iprot.readFieldEnd()
341 | iprot.readStructEnd()
342 |
343 | def write(self, oprot):
344 | if oprot._fast_encode is not None and self.thrift_spec is not None:
345 | oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
346 | return
347 | oprot.writeStructBegin('EDAMSystemException')
348 | if self.errorCode is not None:
349 | oprot.writeFieldBegin('errorCode', TType.I32, 1)
350 | oprot.writeI32(self.errorCode)
351 | oprot.writeFieldEnd()
352 | if self.message is not None:
353 | oprot.writeFieldBegin('message', TType.STRING, 2)
354 | oprot.writeString(self.message.encode('utf-8') if sys.version_info[0] == 2 else self.message)
355 | oprot.writeFieldEnd()
356 | if self.rateLimitDuration is not None:
357 | oprot.writeFieldBegin('rateLimitDuration', TType.I32, 3)
358 | oprot.writeI32(self.rateLimitDuration)
359 | oprot.writeFieldEnd()
360 | oprot.writeFieldStop()
361 | oprot.writeStructEnd()
362 |
363 | def validate(self):
364 | if self.errorCode is None:
365 | raise TProtocolException(message='Required field errorCode is unset!')
366 | return
367 |
368 | def __str__(self):
369 | return repr(self)
370 |
371 | def __repr__(self):
372 | L = ['%s=%r' % (key, value)
373 | for key, value in self.__dict__.items()]
374 | return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
375 |
376 | def __eq__(self, other):
377 | return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
378 |
379 | def __ne__(self, other):
380 | return not (self == other)
381 |
382 |
383 | class EDAMNotFoundException(TException):
384 | """
385 | This exception is thrown by EDAM procedures when a caller asks to perform
386 | an operation on an object that does not exist. This may be thrown based on an invalid
387 | primary identifier (e.g. a bad GUID), or when the caller refers to an object
388 | by another unique identifier (e.g. a User's email address).
389 |
390 | identifier: A description of the object that was not found on the server.
391 | For example, "Note.notebookGuid" when a caller attempts to create a note in a
392 | notebook that does not exist in the user's account.
393 |
394 | key: The value passed from the client in the identifier, which was not
395 | found. For example, the GUID that was not found.
396 |
397 | Attributes:
398 | - identifier
399 | - key
400 | """
401 |
402 |
403 | def __init__(self, identifier=None, key=None,):
404 | self.identifier = identifier
405 | self.key = key
406 |
407 | def read(self, iprot):
408 | if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
409 | iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
410 | return
411 | iprot.readStructBegin()
412 | while True:
413 | (fname, ftype, fid) = iprot.readFieldBegin()
414 | if ftype == TType.STOP:
415 | break
416 | if fid == 1:
417 | if ftype == TType.STRING:
418 | self.identifier = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
419 | else:
420 | iprot.skip(ftype)
421 | elif fid == 2:
422 | if ftype == TType.STRING:
423 | self.key = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
424 | else:
425 | iprot.skip(ftype)
426 | else:
427 | iprot.skip(ftype)
428 | iprot.readFieldEnd()
429 | iprot.readStructEnd()
430 |
431 | def write(self, oprot):
432 | if oprot._fast_encode is not None and self.thrift_spec is not None:
433 | oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
434 | return
435 | oprot.writeStructBegin('EDAMNotFoundException')
436 | if self.identifier is not None:
437 | oprot.writeFieldBegin('identifier', TType.STRING, 1)
438 | oprot.writeString(self.identifier.encode('utf-8') if sys.version_info[0] == 2 else self.identifier)
439 | oprot.writeFieldEnd()
440 | if self.key is not None:
441 | oprot.writeFieldBegin('key', TType.STRING, 2)
442 | oprot.writeString(self.key.encode('utf-8') if sys.version_info[0] == 2 else self.key)
443 | oprot.writeFieldEnd()
444 | oprot.writeFieldStop()
445 | oprot.writeStructEnd()
446 |
447 | def validate(self):
448 | return
449 |
450 | def __str__(self):
451 | return repr(self)
452 |
453 | def __repr__(self):
454 | L = ['%s=%r' % (key, value)
455 | for key, value in self.__dict__.items()]
456 | return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
457 |
458 | def __eq__(self, other):
459 | return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
460 |
461 | def __ne__(self, other):
462 | return not (self == other)
463 |
464 |
465 | class EDAMInvalidContactsException(TException):
466 | """
467 | An exception thrown when the provided Contacts fail validation. For instance,
468 | email domains could be invalid, phone numbers might not be valid for SMS,
469 | etc.
470 |
471 | We will not provide individual reasons for each Contact's validation failure.
472 | The presence of the Contact in this exception means that the user must figure
473 | out how to take appropriate action to fix this Contact.
474 |
475 |
476 | - contacts
477 | - The list of Contacts that are considered invalid by the service
478 |
479 | - parameter
480 | - If the error applied to a particular input parameter, this will
481 | indicate which parameter.
482 |
483 | - reasons
484 | - If supplied, the list of reasons why the server considered a contact invalid,
485 | matching, in order, the list returned in the contacts field.
486 |
487 |
488 | Attributes:
489 | - contacts
490 | - parameter
491 | - reasons
492 | """
493 |
494 |
495 | def __init__(self, contacts=None, parameter=None, reasons=None,):
496 | self.contacts = contacts
497 | self.parameter = parameter
498 | self.reasons = reasons
499 |
500 | def read(self, iprot):
501 | if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
502 | iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
503 | return
504 | iprot.readStructBegin()
505 | while True:
506 | (fname, ftype, fid) = iprot.readFieldBegin()
507 | if ftype == TType.STOP:
508 | break
509 | if fid == 1:
510 | if ftype == TType.LIST:
511 | self.contacts = []
512 | (_etype3, _size0) = iprot.readListBegin()
513 | for _i4 in range(_size0):
514 | _elem5 = evernote.edam.type.ttypes.Contact()
515 | _elem5.read(iprot)
516 | self.contacts.append(_elem5)
517 | iprot.readListEnd()
518 | else:
519 | iprot.skip(ftype)
520 | elif fid == 2:
521 | if ftype == TType.STRING:
522 | self.parameter = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
523 | else:
524 | iprot.skip(ftype)
525 | elif fid == 3:
526 | if ftype == TType.LIST:
527 | self.reasons = []
528 | (_etype9, _size6) = iprot.readListBegin()
529 | for _i10 in range(_size6):
530 | _elem11 = iprot.readI32()
531 | self.reasons.append(_elem11)
532 | iprot.readListEnd()
533 | else:
534 | iprot.skip(ftype)
535 | else:
536 | iprot.skip(ftype)
537 | iprot.readFieldEnd()
538 | iprot.readStructEnd()
539 |
540 | def write(self, oprot):
541 | if oprot._fast_encode is not None and self.thrift_spec is not None:
542 | oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
543 | return
544 | oprot.writeStructBegin('EDAMInvalidContactsException')
545 | if self.contacts is not None:
546 | oprot.writeFieldBegin('contacts', TType.LIST, 1)
547 | oprot.writeListBegin(TType.STRUCT, len(self.contacts))
548 | for iter12 in self.contacts:
549 | iter12.write(oprot)
550 | oprot.writeListEnd()
551 | oprot.writeFieldEnd()
552 | if self.parameter is not None:
553 | oprot.writeFieldBegin('parameter', TType.STRING, 2)
554 | oprot.writeString(self.parameter.encode('utf-8') if sys.version_info[0] == 2 else self.parameter)
555 | oprot.writeFieldEnd()
556 | if self.reasons is not None:
557 | oprot.writeFieldBegin('reasons', TType.LIST, 3)
558 | oprot.writeListBegin(TType.I32, len(self.reasons))
559 | for iter13 in self.reasons:
560 | oprot.writeI32(iter13)
561 | oprot.writeListEnd()
562 | oprot.writeFieldEnd()
563 | oprot.writeFieldStop()
564 | oprot.writeStructEnd()
565 |
566 | def validate(self):
567 | if self.contacts is None:
568 | raise TProtocolException(message='Required field contacts is unset!')
569 | return
570 |
571 | def __str__(self):
572 | return repr(self)
573 |
574 | def __repr__(self):
575 | L = ['%s=%r' % (key, value)
576 | for key, value in self.__dict__.items()]
577 | return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
578 |
579 | def __eq__(self, other):
580 | return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
581 |
582 | def __ne__(self, other):
583 | return not (self == other)
584 | all_structs.append(EDAMUserException)
585 | EDAMUserException.thrift_spec = (
586 | None, # 0
587 | (1, TType.I32, 'errorCode', None, None, ), # 1
588 | (2, TType.STRING, 'parameter', 'UTF8', None, ), # 2
589 | )
590 | all_structs.append(EDAMSystemException)
591 | EDAMSystemException.thrift_spec = (
592 | None, # 0
593 | (1, TType.I32, 'errorCode', None, None, ), # 1
594 | (2, TType.STRING, 'message', 'UTF8', None, ), # 2
595 | (3, TType.I32, 'rateLimitDuration', None, None, ), # 3
596 | )
597 | all_structs.append(EDAMNotFoundException)
598 | EDAMNotFoundException.thrift_spec = (
599 | None, # 0
600 | (1, TType.STRING, 'identifier', 'UTF8', None, ), # 1
601 | (2, TType.STRING, 'key', 'UTF8', None, ), # 2
602 | )
603 | all_structs.append(EDAMInvalidContactsException)
604 | EDAMInvalidContactsException.thrift_spec = (
605 | None, # 0
606 | (1, TType.LIST, 'contacts', (TType.STRUCT, [evernote.edam.type.ttypes.Contact, None], False), None, ), # 1
607 | (2, TType.STRING, 'parameter', 'UTF8', None, ), # 2
608 | (3, TType.LIST, 'reasons', (TType.I32, None, False), None, ), # 3
609 | )
610 | fix_spec(all_structs)
611 | del all_structs
612 |
--------------------------------------------------------------------------------
/lib/evernote/edam/notestore/NoteStore-remote:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # Autogenerated by Thrift Compiler (0.11.0)
4 | #
5 | # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
6 | #
7 | # options string: py:new_style
8 | #
9 |
10 | import sys
11 | import pprint
12 | if sys.version_info[0] > 2:
13 | from urllib.parse import urlparse
14 | else:
15 | from urlparse import urlparse
16 | from thrift.transport import TTransport, TSocket, TSSLSocket, THttpClient
17 | from thrift.protocol.TBinaryProtocol import TBinaryProtocol
18 |
19 | from evernote.edam.notestore import NoteStore
20 | from evernote.edam.notestore.ttypes import *
21 |
22 | if len(sys.argv) <= 1 or sys.argv[1] == '--help':
23 | print('')
24 | print('Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] [-novalidate] [-ca_certs certs] [-keyfile keyfile] [-certfile certfile] function [arg1 [arg2...]]')
25 | print('')
26 | print('Functions:')
27 | print(' SyncState getSyncState(string authenticationToken)')
28 | print(' SyncChunk getFilteredSyncChunk(string authenticationToken, i32 afterUSN, i32 maxEntries, SyncChunkFilter filter)')
29 | print(' SyncState getLinkedNotebookSyncState(string authenticationToken, LinkedNotebook linkedNotebook)')
30 | print(' SyncChunk getLinkedNotebookSyncChunk(string authenticationToken, LinkedNotebook linkedNotebook, i32 afterUSN, i32 maxEntries, bool fullSyncOnly)')
31 | print(' listNotebooks(string authenticationToken)')
32 | print(' listAccessibleBusinessNotebooks(string authenticationToken)')
33 | print(' Notebook getNotebook(string authenticationToken, Guid guid)')
34 | print(' Notebook getDefaultNotebook(string authenticationToken)')
35 | print(' Notebook createNotebook(string authenticationToken, Notebook notebook)')
36 | print(' i32 updateNotebook(string authenticationToken, Notebook notebook)')
37 | print(' i32 expungeNotebook(string authenticationToken, Guid guid)')
38 | print(' listTags(string authenticationToken)')
39 | print(' listTagsByNotebook(string authenticationToken, Guid notebookGuid)')
40 | print(' Tag getTag(string authenticationToken, Guid guid)')
41 | print(' Tag createTag(string authenticationToken, Tag tag)')
42 | print(' i32 updateTag(string authenticationToken, Tag tag)')
43 | print(' void untagAll(string authenticationToken, Guid guid)')
44 | print(' i32 expungeTag(string authenticationToken, Guid guid)')
45 | print(' listSearches(string authenticationToken)')
46 | print(' SavedSearch getSearch(string authenticationToken, Guid guid)')
47 | print(' SavedSearch createSearch(string authenticationToken, SavedSearch search)')
48 | print(' i32 updateSearch(string authenticationToken, SavedSearch search)')
49 | print(' i32 expungeSearch(string authenticationToken, Guid guid)')
50 | print(' i32 findNoteOffset(string authenticationToken, NoteFilter filter, Guid guid)')
51 | print(' NotesMetadataList findNotesMetadata(string authenticationToken, NoteFilter filter, i32 offset, i32 maxNotes, NotesMetadataResultSpec resultSpec)')
52 | print(' NoteCollectionCounts findNoteCounts(string authenticationToken, NoteFilter filter, bool withTrash)')
53 | print(' Note getNoteWithResultSpec(string authenticationToken, Guid guid, NoteResultSpec resultSpec)')
54 | print(' Note getNote(string authenticationToken, Guid guid, bool withContent, bool withResourcesData, bool withResourcesRecognition, bool withResourcesAlternateData)')
55 | print(' LazyMap getNoteApplicationData(string authenticationToken, Guid guid)')
56 | print(' string getNoteApplicationDataEntry(string authenticationToken, Guid guid, string key)')
57 | print(' i32 setNoteApplicationDataEntry(string authenticationToken, Guid guid, string key, string value)')
58 | print(' i32 unsetNoteApplicationDataEntry(string authenticationToken, Guid guid, string key)')
59 | print(' string getNoteContent(string authenticationToken, Guid guid)')
60 | print(' string getNoteSearchText(string authenticationToken, Guid guid, bool noteOnly, bool tokenizeForIndexing)')
61 | print(' string getResourceSearchText(string authenticationToken, Guid guid)')
62 | print(' getNoteTagNames(string authenticationToken, Guid guid)')
63 | print(' Note createNote(string authenticationToken, Note note)')
64 | print(' Note updateNote(string authenticationToken, Note note)')
65 | print(' i32 deleteNote(string authenticationToken, Guid guid)')
66 | print(' i32 expungeNote(string authenticationToken, Guid guid)')
67 | print(' Note copyNote(string authenticationToken, Guid noteGuid, Guid toNotebookGuid)')
68 | print(' listNoteVersions(string authenticationToken, Guid noteGuid)')
69 | print(' Note getNoteVersion(string authenticationToken, Guid noteGuid, i32 updateSequenceNum, bool withResourcesData, bool withResourcesRecognition, bool withResourcesAlternateData)')
70 | print(' Resource getResource(string authenticationToken, Guid guid, bool withData, bool withRecognition, bool withAttributes, bool withAlternateData)')
71 | print(' LazyMap getResourceApplicationData(string authenticationToken, Guid guid)')
72 | print(' string getResourceApplicationDataEntry(string authenticationToken, Guid guid, string key)')
73 | print(' i32 setResourceApplicationDataEntry(string authenticationToken, Guid guid, string key, string value)')
74 | print(' i32 unsetResourceApplicationDataEntry(string authenticationToken, Guid guid, string key)')
75 | print(' i32 updateResource(string authenticationToken, Resource resource)')
76 | print(' string getResourceData(string authenticationToken, Guid guid)')
77 | print(' Resource getResourceByHash(string authenticationToken, Guid noteGuid, string contentHash, bool withData, bool withRecognition, bool withAlternateData)')
78 | print(' string getResourceRecognition(string authenticationToken, Guid guid)')
79 | print(' string getResourceAlternateData(string authenticationToken, Guid guid)')
80 | print(' ResourceAttributes getResourceAttributes(string authenticationToken, Guid guid)')
81 | print(' Notebook getPublicNotebook(UserID userId, string publicUri)')
82 | print(' SharedNotebook shareNotebook(string authenticationToken, SharedNotebook sharedNotebook, string message)')
83 | print(' CreateOrUpdateNotebookSharesResult createOrUpdateNotebookShares(string authenticationToken, NotebookShareTemplate shareTemplate)')
84 | print(' i32 updateSharedNotebook(string authenticationToken, SharedNotebook sharedNotebook)')
85 | print(' Notebook setNotebookRecipientSettings(string authenticationToken, string notebookGuid, NotebookRecipientSettings recipientSettings)')
86 | print(' listSharedNotebooks(string authenticationToken)')
87 | print(' LinkedNotebook createLinkedNotebook(string authenticationToken, LinkedNotebook linkedNotebook)')
88 | print(' i32 updateLinkedNotebook(string authenticationToken, LinkedNotebook linkedNotebook)')
89 | print(' listLinkedNotebooks(string authenticationToken)')
90 | print(' i32 expungeLinkedNotebook(string authenticationToken, Guid guid)')
91 | print(' AuthenticationResult authenticateToSharedNotebook(string shareKeyOrGlobalId, string authenticationToken)')
92 | print(' SharedNotebook getSharedNotebookByAuth(string authenticationToken)')
93 | print(' void emailNote(string authenticationToken, NoteEmailParameters parameters)')
94 | print(' string shareNote(string authenticationToken, Guid guid)')
95 | print(' void stopSharingNote(string authenticationToken, Guid guid)')
96 | print(' AuthenticationResult authenticateToSharedNote(string guid, string noteKey, string authenticationToken)')
97 | print(' RelatedResult findRelated(string authenticationToken, RelatedQuery query, RelatedResultSpec resultSpec)')
98 | print(' UpdateNoteIfUsnMatchesResult updateNoteIfUsnMatches(string authenticationToken, Note note)')
99 | print(' ManageNotebookSharesResult manageNotebookShares(string authenticationToken, ManageNotebookSharesParameters parameters)')
100 | print(' ShareRelationships getNotebookShares(string authenticationToken, string notebookGuid)')
101 | print('')
102 | sys.exit(0)
103 |
104 | pp = pprint.PrettyPrinter(indent=2)
105 | host = 'localhost'
106 | port = 9090
107 | uri = ''
108 | framed = False
109 | ssl = False
110 | validate = True
111 | ca_certs = None
112 | keyfile = None
113 | certfile = None
114 | http = False
115 | argi = 1
116 |
117 | if sys.argv[argi] == '-h':
118 | parts = sys.argv[argi + 1].split(':')
119 | host = parts[0]
120 | if len(parts) > 1:
121 | port = int(parts[1])
122 | argi += 2
123 |
124 | if sys.argv[argi] == '-u':
125 | url = urlparse(sys.argv[argi + 1])
126 | parts = url[1].split(':')
127 | host = parts[0]
128 | if len(parts) > 1:
129 | port = int(parts[1])
130 | else:
131 | port = 80
132 | uri = url[2]
133 | if url[4]:
134 | uri += '?%s' % url[4]
135 | http = True
136 | argi += 2
137 |
138 | if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
139 | framed = True
140 | argi += 1
141 |
142 | if sys.argv[argi] == '-s' or sys.argv[argi] == '-ssl':
143 | ssl = True
144 | argi += 1
145 |
146 | if sys.argv[argi] == '-novalidate':
147 | validate = False
148 | argi += 1
149 |
150 | if sys.argv[argi] == '-ca_certs':
151 | ca_certs = sys.argv[argi+1]
152 | argi += 2
153 |
154 | if sys.argv[argi] == '-keyfile':
155 | keyfile = sys.argv[argi+1]
156 | argi += 2
157 |
158 | if sys.argv[argi] == '-certfile':
159 | certfile = sys.argv[argi+1]
160 | argi += 2
161 |
162 | cmd = sys.argv[argi]
163 | args = sys.argv[argi + 1:]
164 |
165 | if http:
166 | transport = THttpClient.THttpClient(host, port, uri)
167 | else:
168 | if ssl:
169 | socket = TSSLSocket.TSSLSocket(host, port, validate=validate, ca_certs=ca_certs, keyfile=keyfile, certfile=certfile)
170 | else:
171 | socket = TSocket.TSocket(host, port)
172 | if framed:
173 | transport = TTransport.TFramedTransport(socket)
174 | else:
175 | transport = TTransport.TBufferedTransport(socket)
176 | protocol = TBinaryProtocol(transport)
177 | client = NoteStore.Client(protocol)
178 | transport.open()
179 |
180 | if cmd == 'getSyncState':
181 | if len(args) != 1:
182 | print('getSyncState requires 1 args')
183 | sys.exit(1)
184 | pp.pprint(client.getSyncState(args[0],))
185 |
186 | elif cmd == 'getFilteredSyncChunk':
187 | if len(args) != 4:
188 | print('getFilteredSyncChunk requires 4 args')
189 | sys.exit(1)
190 | pp.pprint(client.getFilteredSyncChunk(args[0], eval(args[1]), eval(args[2]), eval(args[3]),))
191 |
192 | elif cmd == 'getLinkedNotebookSyncState':
193 | if len(args) != 2:
194 | print('getLinkedNotebookSyncState requires 2 args')
195 | sys.exit(1)
196 | pp.pprint(client.getLinkedNotebookSyncState(args[0], eval(args[1]),))
197 |
198 | elif cmd == 'getLinkedNotebookSyncChunk':
199 | if len(args) != 5:
200 | print('getLinkedNotebookSyncChunk requires 5 args')
201 | sys.exit(1)
202 | pp.pprint(client.getLinkedNotebookSyncChunk(args[0], eval(args[1]), eval(args[2]), eval(args[3]), eval(args[4]),))
203 |
204 | elif cmd == 'listNotebooks':
205 | if len(args) != 1:
206 | print('listNotebooks requires 1 args')
207 | sys.exit(1)
208 | pp.pprint(client.listNotebooks(args[0],))
209 |
210 | elif cmd == 'listAccessibleBusinessNotebooks':
211 | if len(args) != 1:
212 | print('listAccessibleBusinessNotebooks requires 1 args')
213 | sys.exit(1)
214 | pp.pprint(client.listAccessibleBusinessNotebooks(args[0],))
215 |
216 | elif cmd == 'getNotebook':
217 | if len(args) != 2:
218 | print('getNotebook requires 2 args')
219 | sys.exit(1)
220 | pp.pprint(client.getNotebook(args[0], eval(args[1]),))
221 |
222 | elif cmd == 'getDefaultNotebook':
223 | if len(args) != 1:
224 | print('getDefaultNotebook requires 1 args')
225 | sys.exit(1)
226 | pp.pprint(client.getDefaultNotebook(args[0],))
227 |
228 | elif cmd == 'createNotebook':
229 | if len(args) != 2:
230 | print('createNotebook requires 2 args')
231 | sys.exit(1)
232 | pp.pprint(client.createNotebook(args[0], eval(args[1]),))
233 |
234 | elif cmd == 'updateNotebook':
235 | if len(args) != 2:
236 | print('updateNotebook requires 2 args')
237 | sys.exit(1)
238 | pp.pprint(client.updateNotebook(args[0], eval(args[1]),))
239 |
240 | elif cmd == 'expungeNotebook':
241 | if len(args) != 2:
242 | print('expungeNotebook requires 2 args')
243 | sys.exit(1)
244 | pp.pprint(client.expungeNotebook(args[0], eval(args[1]),))
245 |
246 | elif cmd == 'listTags':
247 | if len(args) != 1:
248 | print('listTags requires 1 args')
249 | sys.exit(1)
250 | pp.pprint(client.listTags(args[0],))
251 |
252 | elif cmd == 'listTagsByNotebook':
253 | if len(args) != 2:
254 | print('listTagsByNotebook requires 2 args')
255 | sys.exit(1)
256 | pp.pprint(client.listTagsByNotebook(args[0], eval(args[1]),))
257 |
258 | elif cmd == 'getTag':
259 | if len(args) != 2:
260 | print('getTag requires 2 args')
261 | sys.exit(1)
262 | pp.pprint(client.getTag(args[0], eval(args[1]),))
263 |
264 | elif cmd == 'createTag':
265 | if len(args) != 2:
266 | print('createTag requires 2 args')
267 | sys.exit(1)
268 | pp.pprint(client.createTag(args[0], eval(args[1]),))
269 |
270 | elif cmd == 'updateTag':
271 | if len(args) != 2:
272 | print('updateTag requires 2 args')
273 | sys.exit(1)
274 | pp.pprint(client.updateTag(args[0], eval(args[1]),))
275 |
276 | elif cmd == 'untagAll':
277 | if len(args) != 2:
278 | print('untagAll requires 2 args')
279 | sys.exit(1)
280 | pp.pprint(client.untagAll(args[0], eval(args[1]),))
281 |
282 | elif cmd == 'expungeTag':
283 | if len(args) != 2:
284 | print('expungeTag requires 2 args')
285 | sys.exit(1)
286 | pp.pprint(client.expungeTag(args[0], eval(args[1]),))
287 |
288 | elif cmd == 'listSearches':
289 | if len(args) != 1:
290 | print('listSearches requires 1 args')
291 | sys.exit(1)
292 | pp.pprint(client.listSearches(args[0],))
293 |
294 | elif cmd == 'getSearch':
295 | if len(args) != 2:
296 | print('getSearch requires 2 args')
297 | sys.exit(1)
298 | pp.pprint(client.getSearch(args[0], eval(args[1]),))
299 |
300 | elif cmd == 'createSearch':
301 | if len(args) != 2:
302 | print('createSearch requires 2 args')
303 | sys.exit(1)
304 | pp.pprint(client.createSearch(args[0], eval(args[1]),))
305 |
306 | elif cmd == 'updateSearch':
307 | if len(args) != 2:
308 | print('updateSearch requires 2 args')
309 | sys.exit(1)
310 | pp.pprint(client.updateSearch(args[0], eval(args[1]),))
311 |
312 | elif cmd == 'expungeSearch':
313 | if len(args) != 2:
314 | print('expungeSearch requires 2 args')
315 | sys.exit(1)
316 | pp.pprint(client.expungeSearch(args[0], eval(args[1]),))
317 |
318 | elif cmd == 'findNoteOffset':
319 | if len(args) != 3:
320 | print('findNoteOffset requires 3 args')
321 | sys.exit(1)
322 | pp.pprint(client.findNoteOffset(args[0], eval(args[1]), eval(args[2]),))
323 |
324 | elif cmd == 'findNotesMetadata':
325 | if len(args) != 5:
326 | print('findNotesMetadata requires 5 args')
327 | sys.exit(1)
328 | pp.pprint(client.findNotesMetadata(args[0], eval(args[1]), eval(args[2]), eval(args[3]), eval(args[4]),))
329 |
330 | elif cmd == 'findNoteCounts':
331 | if len(args) != 3:
332 | print('findNoteCounts requires 3 args')
333 | sys.exit(1)
334 | pp.pprint(client.findNoteCounts(args[0], eval(args[1]), eval(args[2]),))
335 |
336 | elif cmd == 'getNoteWithResultSpec':
337 | if len(args) != 3:
338 | print('getNoteWithResultSpec requires 3 args')
339 | sys.exit(1)
340 | pp.pprint(client.getNoteWithResultSpec(args[0], eval(args[1]), eval(args[2]),))
341 |
342 | elif cmd == 'getNote':
343 | if len(args) != 6:
344 | print('getNote requires 6 args')
345 | sys.exit(1)
346 | pp.pprint(client.getNote(args[0], eval(args[1]), eval(args[2]), eval(args[3]), eval(args[4]), eval(args[5]),))
347 |
348 | elif cmd == 'getNoteApplicationData':
349 | if len(args) != 2:
350 | print('getNoteApplicationData requires 2 args')
351 | sys.exit(1)
352 | pp.pprint(client.getNoteApplicationData(args[0], eval(args[1]),))
353 |
354 | elif cmd == 'getNoteApplicationDataEntry':
355 | if len(args) != 3:
356 | print('getNoteApplicationDataEntry requires 3 args')
357 | sys.exit(1)
358 | pp.pprint(client.getNoteApplicationDataEntry(args[0], eval(args[1]), args[2],))
359 |
360 | elif cmd == 'setNoteApplicationDataEntry':
361 | if len(args) != 4:
362 | print('setNoteApplicationDataEntry requires 4 args')
363 | sys.exit(1)
364 | pp.pprint(client.setNoteApplicationDataEntry(args[0], eval(args[1]), args[2], args[3],))
365 |
366 | elif cmd == 'unsetNoteApplicationDataEntry':
367 | if len(args) != 3:
368 | print('unsetNoteApplicationDataEntry requires 3 args')
369 | sys.exit(1)
370 | pp.pprint(client.unsetNoteApplicationDataEntry(args[0], eval(args[1]), args[2],))
371 |
372 | elif cmd == 'getNoteContent':
373 | if len(args) != 2:
374 | print('getNoteContent requires 2 args')
375 | sys.exit(1)
376 | pp.pprint(client.getNoteContent(args[0], eval(args[1]),))
377 |
378 | elif cmd == 'getNoteSearchText':
379 | if len(args) != 4:
380 | print('getNoteSearchText requires 4 args')
381 | sys.exit(1)
382 | pp.pprint(client.getNoteSearchText(args[0], eval(args[1]), eval(args[2]), eval(args[3]),))
383 |
384 | elif cmd == 'getResourceSearchText':
385 | if len(args) != 2:
386 | print('getResourceSearchText requires 2 args')
387 | sys.exit(1)
388 | pp.pprint(client.getResourceSearchText(args[0], eval(args[1]),))
389 |
390 | elif cmd == 'getNoteTagNames':
391 | if len(args) != 2:
392 | print('getNoteTagNames requires 2 args')
393 | sys.exit(1)
394 | pp.pprint(client.getNoteTagNames(args[0], eval(args[1]),))
395 |
396 | elif cmd == 'createNote':
397 | if len(args) != 2:
398 | print('createNote requires 2 args')
399 | sys.exit(1)
400 | pp.pprint(client.createNote(args[0], eval(args[1]),))
401 |
402 | elif cmd == 'updateNote':
403 | if len(args) != 2:
404 | print('updateNote requires 2 args')
405 | sys.exit(1)
406 | pp.pprint(client.updateNote(args[0], eval(args[1]),))
407 |
408 | elif cmd == 'deleteNote':
409 | if len(args) != 2:
410 | print('deleteNote requires 2 args')
411 | sys.exit(1)
412 | pp.pprint(client.deleteNote(args[0], eval(args[1]),))
413 |
414 | elif cmd == 'expungeNote':
415 | if len(args) != 2:
416 | print('expungeNote requires 2 args')
417 | sys.exit(1)
418 | pp.pprint(client.expungeNote(args[0], eval(args[1]),))
419 |
420 | elif cmd == 'copyNote':
421 | if len(args) != 3:
422 | print('copyNote requires 3 args')
423 | sys.exit(1)
424 | pp.pprint(client.copyNote(args[0], eval(args[1]), eval(args[2]),))
425 |
426 | elif cmd == 'listNoteVersions':
427 | if len(args) != 2:
428 | print('listNoteVersions requires 2 args')
429 | sys.exit(1)
430 | pp.pprint(client.listNoteVersions(args[0], eval(args[1]),))
431 |
432 | elif cmd == 'getNoteVersion':
433 | if len(args) != 6:
434 | print('getNoteVersion requires 6 args')
435 | sys.exit(1)
436 | pp.pprint(client.getNoteVersion(args[0], eval(args[1]), eval(args[2]), eval(args[3]), eval(args[4]), eval(args[5]),))
437 |
438 | elif cmd == 'getResource':
439 | if len(args) != 6:
440 | print('getResource requires 6 args')
441 | sys.exit(1)
442 | pp.pprint(client.getResource(args[0], eval(args[1]), eval(args[2]), eval(args[3]), eval(args[4]), eval(args[5]),))
443 |
444 | elif cmd == 'getResourceApplicationData':
445 | if len(args) != 2:
446 | print('getResourceApplicationData requires 2 args')
447 | sys.exit(1)
448 | pp.pprint(client.getResourceApplicationData(args[0], eval(args[1]),))
449 |
450 | elif cmd == 'getResourceApplicationDataEntry':
451 | if len(args) != 3:
452 | print('getResourceApplicationDataEntry requires 3 args')
453 | sys.exit(1)
454 | pp.pprint(client.getResourceApplicationDataEntry(args[0], eval(args[1]), args[2],))
455 |
456 | elif cmd == 'setResourceApplicationDataEntry':
457 | if len(args) != 4:
458 | print('setResourceApplicationDataEntry requires 4 args')
459 | sys.exit(1)
460 | pp.pprint(client.setResourceApplicationDataEntry(args[0], eval(args[1]), args[2], args[3],))
461 |
462 | elif cmd == 'unsetResourceApplicationDataEntry':
463 | if len(args) != 3:
464 | print('unsetResourceApplicationDataEntry requires 3 args')
465 | sys.exit(1)
466 | pp.pprint(client.unsetResourceApplicationDataEntry(args[0], eval(args[1]), args[2],))
467 |
468 | elif cmd == 'updateResource':
469 | if len(args) != 2:
470 | print('updateResource requires 2 args')
471 | sys.exit(1)
472 | pp.pprint(client.updateResource(args[0], eval(args[1]),))
473 |
474 | elif cmd == 'getResourceData':
475 | if len(args) != 2:
476 | print('getResourceData requires 2 args')
477 | sys.exit(1)
478 | pp.pprint(client.getResourceData(args[0], eval(args[1]),))
479 |
480 | elif cmd == 'getResourceByHash':
481 | if len(args) != 6:
482 | print('getResourceByHash requires 6 args')
483 | sys.exit(1)
484 | pp.pprint(client.getResourceByHash(args[0], eval(args[1]), args[2], eval(args[3]), eval(args[4]), eval(args[5]),))
485 |
486 | elif cmd == 'getResourceRecognition':
487 | if len(args) != 2:
488 | print('getResourceRecognition requires 2 args')
489 | sys.exit(1)
490 | pp.pprint(client.getResourceRecognition(args[0], eval(args[1]),))
491 |
492 | elif cmd == 'getResourceAlternateData':
493 | if len(args) != 2:
494 | print('getResourceAlternateData requires 2 args')
495 | sys.exit(1)
496 | pp.pprint(client.getResourceAlternateData(args[0], eval(args[1]),))
497 |
498 | elif cmd == 'getResourceAttributes':
499 | if len(args) != 2:
500 | print('getResourceAttributes requires 2 args')
501 | sys.exit(1)
502 | pp.pprint(client.getResourceAttributes(args[0], eval(args[1]),))
503 |
504 | elif cmd == 'getPublicNotebook':
505 | if len(args) != 2:
506 | print('getPublicNotebook requires 2 args')
507 | sys.exit(1)
508 | pp.pprint(client.getPublicNotebook(eval(args[0]), args[1],))
509 |
510 | elif cmd == 'shareNotebook':
511 | if len(args) != 3:
512 | print('shareNotebook requires 3 args')
513 | sys.exit(1)
514 | pp.pprint(client.shareNotebook(args[0], eval(args[1]), args[2],))
515 |
516 | elif cmd == 'createOrUpdateNotebookShares':
517 | if len(args) != 2:
518 | print('createOrUpdateNotebookShares requires 2 args')
519 | sys.exit(1)
520 | pp.pprint(client.createOrUpdateNotebookShares(args[0], eval(args[1]),))
521 |
522 | elif cmd == 'updateSharedNotebook':
523 | if len(args) != 2:
524 | print('updateSharedNotebook requires 2 args')
525 | sys.exit(1)
526 | pp.pprint(client.updateSharedNotebook(args[0], eval(args[1]),))
527 |
528 | elif cmd == 'setNotebookRecipientSettings':
529 | if len(args) != 3:
530 | print('setNotebookRecipientSettings requires 3 args')
531 | sys.exit(1)
532 | pp.pprint(client.setNotebookRecipientSettings(args[0], args[1], eval(args[2]),))
533 |
534 | elif cmd == 'listSharedNotebooks':
535 | if len(args) != 1:
536 | print('listSharedNotebooks requires 1 args')
537 | sys.exit(1)
538 | pp.pprint(client.listSharedNotebooks(args[0],))
539 |
540 | elif cmd == 'createLinkedNotebook':
541 | if len(args) != 2:
542 | print('createLinkedNotebook requires 2 args')
543 | sys.exit(1)
544 | pp.pprint(client.createLinkedNotebook(args[0], eval(args[1]),))
545 |
546 | elif cmd == 'updateLinkedNotebook':
547 | if len(args) != 2:
548 | print('updateLinkedNotebook requires 2 args')
549 | sys.exit(1)
550 | pp.pprint(client.updateLinkedNotebook(args[0], eval(args[1]),))
551 |
552 | elif cmd == 'listLinkedNotebooks':
553 | if len(args) != 1:
554 | print('listLinkedNotebooks requires 1 args')
555 | sys.exit(1)
556 | pp.pprint(client.listLinkedNotebooks(args[0],))
557 |
558 | elif cmd == 'expungeLinkedNotebook':
559 | if len(args) != 2:
560 | print('expungeLinkedNotebook requires 2 args')
561 | sys.exit(1)
562 | pp.pprint(client.expungeLinkedNotebook(args[0], eval(args[1]),))
563 |
564 | elif cmd == 'authenticateToSharedNotebook':
565 | if len(args) != 2:
566 | print('authenticateToSharedNotebook requires 2 args')
567 | sys.exit(1)
568 | pp.pprint(client.authenticateToSharedNotebook(args[0], args[1],))
569 |
570 | elif cmd == 'getSharedNotebookByAuth':
571 | if len(args) != 1:
572 | print('getSharedNotebookByAuth requires 1 args')
573 | sys.exit(1)
574 | pp.pprint(client.getSharedNotebookByAuth(args[0],))
575 |
576 | elif cmd == 'emailNote':
577 | if len(args) != 2:
578 | print('emailNote requires 2 args')
579 | sys.exit(1)
580 | pp.pprint(client.emailNote(args[0], eval(args[1]),))
581 |
582 | elif cmd == 'shareNote':
583 | if len(args) != 2:
584 | print('shareNote requires 2 args')
585 | sys.exit(1)
586 | pp.pprint(client.shareNote(args[0], eval(args[1]),))
587 |
588 | elif cmd == 'stopSharingNote':
589 | if len(args) != 2:
590 | print('stopSharingNote requires 2 args')
591 | sys.exit(1)
592 | pp.pprint(client.stopSharingNote(args[0], eval(args[1]),))
593 |
594 | elif cmd == 'authenticateToSharedNote':
595 | if len(args) != 3:
596 | print('authenticateToSharedNote requires 3 args')
597 | sys.exit(1)
598 | pp.pprint(client.authenticateToSharedNote(args[0], args[1], args[2],))
599 |
600 | elif cmd == 'findRelated':
601 | if len(args) != 3:
602 | print('findRelated requires 3 args')
603 | sys.exit(1)
604 | pp.pprint(client.findRelated(args[0], eval(args[1]), eval(args[2]),))
605 |
606 | elif cmd == 'updateNoteIfUsnMatches':
607 | if len(args) != 2:
608 | print('updateNoteIfUsnMatches requires 2 args')
609 | sys.exit(1)
610 | pp.pprint(client.updateNoteIfUsnMatches(args[0], eval(args[1]),))
611 |
612 | elif cmd == 'manageNotebookShares':
613 | if len(args) != 2:
614 | print('manageNotebookShares requires 2 args')
615 | sys.exit(1)
616 | pp.pprint(client.manageNotebookShares(args[0], eval(args[1]),))
617 |
618 | elif cmd == 'getNotebookShares':
619 | if len(args) != 2:
620 | print('getNotebookShares requires 2 args')
621 | sys.exit(1)
622 | pp.pprint(client.getNotebookShares(args[0], args[1],))
623 |
624 | else:
625 | print('Unrecognized method %s' % cmd)
626 | sys.exit(1)
627 |
628 | transport.close()
629 |
--------------------------------------------------------------------------------
/lib/evernote/edam/userstore/ttypes.py:
--------------------------------------------------------------------------------
1 | #
2 | # Autogenerated by Thrift Compiler (0.11.0)
3 | #
4 | # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5 | #
6 | # options string: py:new_style
7 | #
8 |
9 | from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
10 | from thrift.protocol.TProtocol import TProtocolException
11 | from thrift.TRecursive import fix_spec
12 |
13 | import sys
14 | import evernote.edam.type.ttypes
15 | import evernote.edam.error.ttypes
16 |
17 | from thrift.transport import TTransport
18 | all_structs = []
19 |
20 |
21 | class PublicUserInfo(object):
22 | """
23 | This structure is used to provide publicly-available user information
24 | about a particular account.
25 |
26 | - userId:
27 | -
28 | The unique numeric user identifier for the user account.
29 |
30 | - serviceLevel:
31 | -
32 | The service level of the account.
33 |
34 | - noteStoreUrl:
35 | -
36 | This field will contain the full URL that clients should use to make
37 | NoteStore requests to the server shard that contains that user's data.
38 | I.e. this is the URL that should be used to create the Thrift HTTP client
39 | transport to send messages to the NoteStore service for the account.
40 |
41 | - webApiUrlPrefix:
42 | -
43 | This field will contain the initial part of the URLs that should be used
44 | to make requests to Evernote's thin client "web API", which provide
45 | optimized operations for clients that aren't capable of manipulating
46 | the full contents of accounts via the full Thrift data model. Clients
47 | should concatenate the relative path for the various servlets onto the
48 | end of this string to construct the full URL, as documented on our
49 | developer web site.
50 |
51 |
52 |
53 | Attributes:
54 | - userId
55 | - serviceLevel
56 | - username
57 | - noteStoreUrl
58 | - webApiUrlPrefix
59 | """
60 |
61 |
62 | def __init__(self, userId=None, serviceLevel=None, username=None, noteStoreUrl=None, webApiUrlPrefix=None,):
63 | self.userId = userId
64 | self.serviceLevel = serviceLevel
65 | self.username = username
66 | self.noteStoreUrl = noteStoreUrl
67 | self.webApiUrlPrefix = webApiUrlPrefix
68 |
69 | def read(self, iprot):
70 | if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
71 | iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
72 | return
73 | iprot.readStructBegin()
74 | while True:
75 | (fname, ftype, fid) = iprot.readFieldBegin()
76 | if ftype == TType.STOP:
77 | break
78 | if fid == 1:
79 | if ftype == TType.I32:
80 | self.userId = iprot.readI32()
81 | else:
82 | iprot.skip(ftype)
83 | elif fid == 7:
84 | if ftype == TType.I32:
85 | self.serviceLevel = iprot.readI32()
86 | else:
87 | iprot.skip(ftype)
88 | elif fid == 4:
89 | if ftype == TType.STRING:
90 | self.username = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
91 | else:
92 | iprot.skip(ftype)
93 | elif fid == 5:
94 | if ftype == TType.STRING:
95 | self.noteStoreUrl = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
96 | else:
97 | iprot.skip(ftype)
98 | elif fid == 6:
99 | if ftype == TType.STRING:
100 | self.webApiUrlPrefix = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
101 | else:
102 | iprot.skip(ftype)
103 | else:
104 | iprot.skip(ftype)
105 | iprot.readFieldEnd()
106 | iprot.readStructEnd()
107 |
108 | def write(self, oprot):
109 | if oprot._fast_encode is not None and self.thrift_spec is not None:
110 | oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
111 | return
112 | oprot.writeStructBegin('PublicUserInfo')
113 | if self.userId is not None:
114 | oprot.writeFieldBegin('userId', TType.I32, 1)
115 | oprot.writeI32(self.userId)
116 | oprot.writeFieldEnd()
117 | if self.username is not None:
118 | oprot.writeFieldBegin('username', TType.STRING, 4)
119 | oprot.writeString(self.username.encode('utf-8') if sys.version_info[0] == 2 else self.username)
120 | oprot.writeFieldEnd()
121 | if self.noteStoreUrl is not None:
122 | oprot.writeFieldBegin('noteStoreUrl', TType.STRING, 5)
123 | oprot.writeString(self.noteStoreUrl.encode('utf-8') if sys.version_info[0] == 2 else self.noteStoreUrl)
124 | oprot.writeFieldEnd()
125 | if self.webApiUrlPrefix is not None:
126 | oprot.writeFieldBegin('webApiUrlPrefix', TType.STRING, 6)
127 | oprot.writeString(self.webApiUrlPrefix.encode('utf-8') if sys.version_info[0] == 2 else self.webApiUrlPrefix)
128 | oprot.writeFieldEnd()
129 | if self.serviceLevel is not None:
130 | oprot.writeFieldBegin('serviceLevel', TType.I32, 7)
131 | oprot.writeI32(self.serviceLevel)
132 | oprot.writeFieldEnd()
133 | oprot.writeFieldStop()
134 | oprot.writeStructEnd()
135 |
136 | def validate(self):
137 | if self.userId is None:
138 | raise TProtocolException(message='Required field userId is unset!')
139 | return
140 |
141 | def __repr__(self):
142 | L = ['%s=%r' % (key, value)
143 | for key, value in self.__dict__.items()]
144 | return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
145 |
146 | def __eq__(self, other):
147 | return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
148 |
149 | def __ne__(self, other):
150 | return not (self == other)
151 |
152 |
153 | class UserUrls(object):
154 | """
155 |
156 | - noteStoreUrl:
157 | -
158 | This field will contain the full URL that clients should use to make
159 | NoteStore requests to the server shard that contains that user's data.
160 | I.e. this is the URL that should be used to create the Thrift HTTP client
161 | transport to send messages to the NoteStore service for the account.
162 |
163 | - webApiUrlPrefix:
164 | -
165 | This field will contain the initial part of the URLs that should be used
166 | to make requests to Evernote's thin client "web API", which provide
167 | optimized operations for clients that aren't capable of manipulating
168 | the full contents of accounts via the full Thrift data model. Clients
169 | should concatenate the relative path for the various servlets onto the
170 | end of this string to construct the full URL, as documented on our
171 | developer web site.
172 |
173 | - userStoreUrl:
174 | -
175 | This field will contain the full URL that clients should use to make UserStore
176 | requests after successfully authenticating. I.e. this is the URL that should be used
177 | to create the Thrift HTTP client transport to send messages to the UserStore service
178 | for this account.
179 |
180 | - utilityUrl:
181 | -
182 | This field will contain the full URL that clients should use to make Utility requests
183 | to the server shard that contains that user's data. I.e. this is the URL that should
184 | be used to create the Thrift HTTP client transport to send messages to the Utility
185 | service for the account.
186 |
187 | - messageStoreUrl:
188 | -
189 | This field will contain the full URL that clients should use to make MessageStore
190 | requests to the server. I.e. this is the URL that should be used to create the
191 | Thrift HTTP client transport to send messages to the MessageStore service for the
192 | account.
193 |
194 | - userWebSocketUrl:
195 | -
196 | This field will contain the full URL that clients should use when opening a
197 | persistent web socket to recieve notification of events for the authenticated user.
198 |
199 |
200 |
201 | Attributes:
202 | - noteStoreUrl
203 | - webApiUrlPrefix
204 | - userStoreUrl
205 | - utilityUrl
206 | - messageStoreUrl
207 | - userWebSocketUrl
208 | """
209 |
210 |
211 | def __init__(self, noteStoreUrl=None, webApiUrlPrefix=None, userStoreUrl=None, utilityUrl=None, messageStoreUrl=None, userWebSocketUrl=None,):
212 | self.noteStoreUrl = noteStoreUrl
213 | self.webApiUrlPrefix = webApiUrlPrefix
214 | self.userStoreUrl = userStoreUrl
215 | self.utilityUrl = utilityUrl
216 | self.messageStoreUrl = messageStoreUrl
217 | self.userWebSocketUrl = userWebSocketUrl
218 |
219 | def read(self, iprot):
220 | if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
221 | iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
222 | return
223 | iprot.readStructBegin()
224 | while True:
225 | (fname, ftype, fid) = iprot.readFieldBegin()
226 | if ftype == TType.STOP:
227 | break
228 | if fid == 1:
229 | if ftype == TType.STRING:
230 | self.noteStoreUrl = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
231 | else:
232 | iprot.skip(ftype)
233 | elif fid == 2:
234 | if ftype == TType.STRING:
235 | self.webApiUrlPrefix = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
236 | else:
237 | iprot.skip(ftype)
238 | elif fid == 3:
239 | if ftype == TType.STRING:
240 | self.userStoreUrl = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
241 | else:
242 | iprot.skip(ftype)
243 | elif fid == 4:
244 | if ftype == TType.STRING:
245 | self.utilityUrl = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
246 | else:
247 | iprot.skip(ftype)
248 | elif fid == 5:
249 | if ftype == TType.STRING:
250 | self.messageStoreUrl = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
251 | else:
252 | iprot.skip(ftype)
253 | elif fid == 6:
254 | if ftype == TType.STRING:
255 | self.userWebSocketUrl = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
256 | else:
257 | iprot.skip(ftype)
258 | else:
259 | iprot.skip(ftype)
260 | iprot.readFieldEnd()
261 | iprot.readStructEnd()
262 |
263 | def write(self, oprot):
264 | if oprot._fast_encode is not None and self.thrift_spec is not None:
265 | oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
266 | return
267 | oprot.writeStructBegin('UserUrls')
268 | if self.noteStoreUrl is not None:
269 | oprot.writeFieldBegin('noteStoreUrl', TType.STRING, 1)
270 | oprot.writeString(self.noteStoreUrl.encode('utf-8') if sys.version_info[0] == 2 else self.noteStoreUrl)
271 | oprot.writeFieldEnd()
272 | if self.webApiUrlPrefix is not None:
273 | oprot.writeFieldBegin('webApiUrlPrefix', TType.STRING, 2)
274 | oprot.writeString(self.webApiUrlPrefix.encode('utf-8') if sys.version_info[0] == 2 else self.webApiUrlPrefix)
275 | oprot.writeFieldEnd()
276 | if self.userStoreUrl is not None:
277 | oprot.writeFieldBegin('userStoreUrl', TType.STRING, 3)
278 | oprot.writeString(self.userStoreUrl.encode('utf-8') if sys.version_info[0] == 2 else self.userStoreUrl)
279 | oprot.writeFieldEnd()
280 | if self.utilityUrl is not None:
281 | oprot.writeFieldBegin('utilityUrl', TType.STRING, 4)
282 | oprot.writeString(self.utilityUrl.encode('utf-8') if sys.version_info[0] == 2 else self.utilityUrl)
283 | oprot.writeFieldEnd()
284 | if self.messageStoreUrl is not None:
285 | oprot.writeFieldBegin('messageStoreUrl', TType.STRING, 5)
286 | oprot.writeString(self.messageStoreUrl.encode('utf-8') if sys.version_info[0] == 2 else self.messageStoreUrl)
287 | oprot.writeFieldEnd()
288 | if self.userWebSocketUrl is not None:
289 | oprot.writeFieldBegin('userWebSocketUrl', TType.STRING, 6)
290 | oprot.writeString(self.userWebSocketUrl.encode('utf-8') if sys.version_info[0] == 2 else self.userWebSocketUrl)
291 | oprot.writeFieldEnd()
292 | oprot.writeFieldStop()
293 | oprot.writeStructEnd()
294 |
295 | def validate(self):
296 | return
297 |
298 | def __repr__(self):
299 | L = ['%s=%r' % (key, value)
300 | for key, value in self.__dict__.items()]
301 | return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
302 |
303 | def __eq__(self, other):
304 | return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
305 |
306 | def __ne__(self, other):
307 | return not (self == other)
308 |
309 |
310 | class AuthenticationResult(object):
311 | """
312 | When an authentication (or re-authentication) is performed, this structure
313 | provides the result to the client.
314 |
315 | - currentTime:
316 | -
317 | The server-side date and time when this result was
318 | generated.
319 |
320 | - authenticationToken:
321 | -
322 | Holds an opaque, ASCII-encoded token that can be
323 | used by the client to perform actions on a NoteStore.
324 |
325 | - expiration:
326 | -
327 | Holds the server-side date and time when the
328 | authentication token will expire.
329 | This time can be compared to "currentTime" to produce an expiration
330 | time that can be reconciled with the client's local clock.
331 |
332 | - user:
333 | -
334 | Holds the information about the account which was
335 | authenticated if this was a full authentication. May be absent if this
336 | particular authentication did not require user information.
337 |
338 | - publicUserInfo:
339 | -
340 | If this authentication result was achieved without full permissions to
341 | access the full User structure, this field may be set to give back
342 | a more limited public set of data.
343 |
344 | - noteStoreUrl:
345 | -
346 | DEPRECATED - Client applications should use urls.noteStoreUrl.
347 |
348 | - webApiUrlPrefix:
349 | -
350 | DEPRECATED - Client applications should use urls.webApiUrlPrefix.
351 |
352 | - secondFactorRequired:
353 | -
354 | If set to true, this field indicates that the user has enabled two-factor
355 | authentication and must enter their second factor in order to complete
356 | authentication. In this case the value of authenticationResult will be
357 | a short-lived authentication token that may only be used to make a
358 | subsequent call to completeTwoFactorAuthentication.
359 |
360 | - secondFactorDeliveryHint:
361 | -
362 | When secondFactorRequired is set to true, this field may contain a string
363 | describing the second factor delivery method that the user has configured.
364 | This will typically be an obfuscated mobile device number, such as
365 | "(xxx) xxx-x095". This string can be displayed to the user to remind them
366 | how to obtain the required second factor.
367 |
368 | - urls
369 | -
370 | This structure will contain all of the URLs that clients need to make requests to the
371 | Evernote service on behalf of the authenticated User.
372 |
373 |
374 |
375 | Attributes:
376 | - currentTime
377 | - authenticationToken
378 | - expiration
379 | - user
380 | - publicUserInfo
381 | - noteStoreUrl
382 | - webApiUrlPrefix
383 | - secondFactorRequired
384 | - secondFactorDeliveryHint
385 | - urls
386 | """
387 |
388 |
389 | def __init__(self, currentTime=None, authenticationToken=None, expiration=None, user=None, publicUserInfo=None, noteStoreUrl=None, webApiUrlPrefix=None, secondFactorRequired=None, secondFactorDeliveryHint=None, urls=None,):
390 | self.currentTime = currentTime
391 | self.authenticationToken = authenticationToken
392 | self.expiration = expiration
393 | self.user = user
394 | self.publicUserInfo = publicUserInfo
395 | self.noteStoreUrl = noteStoreUrl
396 | self.webApiUrlPrefix = webApiUrlPrefix
397 | self.secondFactorRequired = secondFactorRequired
398 | self.secondFactorDeliveryHint = secondFactorDeliveryHint
399 | self.urls = urls
400 |
401 | def read(self, iprot):
402 | if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
403 | iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
404 | return
405 | iprot.readStructBegin()
406 | while True:
407 | (fname, ftype, fid) = iprot.readFieldBegin()
408 | if ftype == TType.STOP:
409 | break
410 | if fid == 1:
411 | if ftype == TType.I64:
412 | self.currentTime = iprot.readI64()
413 | else:
414 | iprot.skip(ftype)
415 | elif fid == 2:
416 | if ftype == TType.STRING:
417 | self.authenticationToken = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
418 | else:
419 | iprot.skip(ftype)
420 | elif fid == 3:
421 | if ftype == TType.I64:
422 | self.expiration = iprot.readI64()
423 | else:
424 | iprot.skip(ftype)
425 | elif fid == 4:
426 | if ftype == TType.STRUCT:
427 | self.user = evernote.edam.type.ttypes.User()
428 | self.user.read(iprot)
429 | else:
430 | iprot.skip(ftype)
431 | elif fid == 5:
432 | if ftype == TType.STRUCT:
433 | self.publicUserInfo = PublicUserInfo()
434 | self.publicUserInfo.read(iprot)
435 | else:
436 | iprot.skip(ftype)
437 | elif fid == 6:
438 | if ftype == TType.STRING:
439 | self.noteStoreUrl = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
440 | else:
441 | iprot.skip(ftype)
442 | elif fid == 7:
443 | if ftype == TType.STRING:
444 | self.webApiUrlPrefix = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
445 | else:
446 | iprot.skip(ftype)
447 | elif fid == 8:
448 | if ftype == TType.BOOL:
449 | self.secondFactorRequired = iprot.readBool()
450 | else:
451 | iprot.skip(ftype)
452 | elif fid == 9:
453 | if ftype == TType.STRING:
454 | self.secondFactorDeliveryHint = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
455 | else:
456 | iprot.skip(ftype)
457 | elif fid == 10:
458 | if ftype == TType.STRUCT:
459 | self.urls = UserUrls()
460 | self.urls.read(iprot)
461 | else:
462 | iprot.skip(ftype)
463 | else:
464 | iprot.skip(ftype)
465 | iprot.readFieldEnd()
466 | iprot.readStructEnd()
467 |
468 | def write(self, oprot):
469 | if oprot._fast_encode is not None and self.thrift_spec is not None:
470 | oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
471 | return
472 | oprot.writeStructBegin('AuthenticationResult')
473 | if self.currentTime is not None:
474 | oprot.writeFieldBegin('currentTime', TType.I64, 1)
475 | oprot.writeI64(self.currentTime)
476 | oprot.writeFieldEnd()
477 | if self.authenticationToken is not None:
478 | oprot.writeFieldBegin('authenticationToken', TType.STRING, 2)
479 | oprot.writeString(self.authenticationToken.encode('utf-8') if sys.version_info[0] == 2 else self.authenticationToken)
480 | oprot.writeFieldEnd()
481 | if self.expiration is not None:
482 | oprot.writeFieldBegin('expiration', TType.I64, 3)
483 | oprot.writeI64(self.expiration)
484 | oprot.writeFieldEnd()
485 | if self.user is not None:
486 | oprot.writeFieldBegin('user', TType.STRUCT, 4)
487 | self.user.write(oprot)
488 | oprot.writeFieldEnd()
489 | if self.publicUserInfo is not None:
490 | oprot.writeFieldBegin('publicUserInfo', TType.STRUCT, 5)
491 | self.publicUserInfo.write(oprot)
492 | oprot.writeFieldEnd()
493 | if self.noteStoreUrl is not None:
494 | oprot.writeFieldBegin('noteStoreUrl', TType.STRING, 6)
495 | oprot.writeString(self.noteStoreUrl.encode('utf-8') if sys.version_info[0] == 2 else self.noteStoreUrl)
496 | oprot.writeFieldEnd()
497 | if self.webApiUrlPrefix is not None:
498 | oprot.writeFieldBegin('webApiUrlPrefix', TType.STRING, 7)
499 | oprot.writeString(self.webApiUrlPrefix.encode('utf-8') if sys.version_info[0] == 2 else self.webApiUrlPrefix)
500 | oprot.writeFieldEnd()
501 | if self.secondFactorRequired is not None:
502 | oprot.writeFieldBegin('secondFactorRequired', TType.BOOL, 8)
503 | oprot.writeBool(self.secondFactorRequired)
504 | oprot.writeFieldEnd()
505 | if self.secondFactorDeliveryHint is not None:
506 | oprot.writeFieldBegin('secondFactorDeliveryHint', TType.STRING, 9)
507 | oprot.writeString(self.secondFactorDeliveryHint.encode('utf-8') if sys.version_info[0] == 2 else self.secondFactorDeliveryHint)
508 | oprot.writeFieldEnd()
509 | if self.urls is not None:
510 | oprot.writeFieldBegin('urls', TType.STRUCT, 10)
511 | self.urls.write(oprot)
512 | oprot.writeFieldEnd()
513 | oprot.writeFieldStop()
514 | oprot.writeStructEnd()
515 |
516 | def validate(self):
517 | if self.currentTime is None:
518 | raise TProtocolException(message='Required field currentTime is unset!')
519 | if self.authenticationToken is None:
520 | raise TProtocolException(message='Required field authenticationToken is unset!')
521 | if self.expiration is None:
522 | raise TProtocolException(message='Required field expiration is unset!')
523 | return
524 |
525 | def __repr__(self):
526 | L = ['%s=%r' % (key, value)
527 | for key, value in self.__dict__.items()]
528 | return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
529 |
530 | def __eq__(self, other):
531 | return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
532 |
533 | def __ne__(self, other):
534 | return not (self == other)
535 |
536 |
537 | class BootstrapSettings(object):
538 | """
539 | This structure describes a collection of bootstrap settings.
540 |
541 | - serviceHost:
542 | -
543 | The hostname and optional port for composing Evernote web service URLs.
544 | This URL can be used to access the UserStore and related services,
545 | but must not be used to compose the NoteStore URL. Client applications
546 | must handle serviceHost values that include only the hostname
547 | (e.g. www.evernote.com) or both the hostname and port (e.g. www.evernote.com:8080).
548 | If no port is specified, or if port 443 is specified, client applications must
549 | use the scheme "https" when composing URLs. Otherwise, a client must use the
550 | scheme "http".
551 |
552 | - marketingUrl:
553 | -
554 | The URL stem for the Evernote corporate marketing website, e.g. http://www.evernote.com.
555 | This stem can be used to compose website URLs. For example, the URL of the Evernote
556 | Trunk is composed by appending "/about/trunk/" to the value of marketingUrl.
557 |
558 | - supportUrl:
559 | -
560 | The full URL for the Evernote customer support website, e.g. https://support.evernote.com.
561 |
562 | - accountEmailDomain:
563 | -
564 | The domain used for an Evernote user's incoming email address, which allows notes to
565 | be emailed into an account. E.g. m.evernote.com.
566 |
567 | - enableFacebookSharing:
568 | -
569 | Whether the client application should enable sharing of notes on Facebook.
570 |
571 | - enableGiftSubscriptions:
572 | -
573 | Whether the client application should enable gift subscriptions.
574 |
575 | - enableSupportTickets:
576 | -
577 | Whether the client application should enable in-client creation of support tickets.
578 |
579 | - enableSharedNotebooks:
580 | -
581 | Whether the client application should enable shared notebooks.
582 |
583 | - enableSingleNoteSharing:
584 | -
585 | Whether the client application should enable single note sharing.
586 |
587 | - enableSponsoredAccounts:
588 | -
589 | Whether the client application should enable sponsored accounts.
590 |
591 | - enableTwitterSharing:
592 | -
593 | Whether the client application should enable sharing of notes on Twitter.
594 |
595 | - enableGoogle:
596 | -
597 | Whether the client application should enable authentication with Google,
598 | for example to allow integration with a user's Gmail contacts.
599 |
600 |
601 | Attributes:
602 | - serviceHost
603 | - marketingUrl
604 | - supportUrl
605 | - accountEmailDomain
606 | - enableFacebookSharing
607 | - enableGiftSubscriptions
608 | - enableSupportTickets
609 | - enableSharedNotebooks
610 | - enableSingleNoteSharing
611 | - enableSponsoredAccounts
612 | - enableTwitterSharing
613 | - enableLinkedInSharing
614 | - enablePublicNotebooks
615 | - enableGoogle
616 | """
617 |
618 |
619 | def __init__(self, serviceHost=None, marketingUrl=None, supportUrl=None, accountEmailDomain=None, enableFacebookSharing=None, enableGiftSubscriptions=None, enableSupportTickets=None, enableSharedNotebooks=None, enableSingleNoteSharing=None, enableSponsoredAccounts=None, enableTwitterSharing=None, enableLinkedInSharing=None, enablePublicNotebooks=None, enableGoogle=None,):
620 | self.serviceHost = serviceHost
621 | self.marketingUrl = marketingUrl
622 | self.supportUrl = supportUrl
623 | self.accountEmailDomain = accountEmailDomain
624 | self.enableFacebookSharing = enableFacebookSharing
625 | self.enableGiftSubscriptions = enableGiftSubscriptions
626 | self.enableSupportTickets = enableSupportTickets
627 | self.enableSharedNotebooks = enableSharedNotebooks
628 | self.enableSingleNoteSharing = enableSingleNoteSharing
629 | self.enableSponsoredAccounts = enableSponsoredAccounts
630 | self.enableTwitterSharing = enableTwitterSharing
631 | self.enableLinkedInSharing = enableLinkedInSharing
632 | self.enablePublicNotebooks = enablePublicNotebooks
633 | self.enableGoogle = enableGoogle
634 |
635 | def read(self, iprot):
636 | if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
637 | iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
638 | return
639 | iprot.readStructBegin()
640 | while True:
641 | (fname, ftype, fid) = iprot.readFieldBegin()
642 | if ftype == TType.STOP:
643 | break
644 | if fid == 1:
645 | if ftype == TType.STRING:
646 | self.serviceHost = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
647 | else:
648 | iprot.skip(ftype)
649 | elif fid == 2:
650 | if ftype == TType.STRING:
651 | self.marketingUrl = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
652 | else:
653 | iprot.skip(ftype)
654 | elif fid == 3:
655 | if ftype == TType.STRING:
656 | self.supportUrl = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
657 | else:
658 | iprot.skip(ftype)
659 | elif fid == 4:
660 | if ftype == TType.STRING:
661 | self.accountEmailDomain = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
662 | else:
663 | iprot.skip(ftype)
664 | elif fid == 5:
665 | if ftype == TType.BOOL:
666 | self.enableFacebookSharing = iprot.readBool()
667 | else:
668 | iprot.skip(ftype)
669 | elif fid == 6:
670 | if ftype == TType.BOOL:
671 | self.enableGiftSubscriptions = iprot.readBool()
672 | else:
673 | iprot.skip(ftype)
674 | elif fid == 7:
675 | if ftype == TType.BOOL:
676 | self.enableSupportTickets = iprot.readBool()
677 | else:
678 | iprot.skip(ftype)
679 | elif fid == 8:
680 | if ftype == TType.BOOL:
681 | self.enableSharedNotebooks = iprot.readBool()
682 | else:
683 | iprot.skip(ftype)
684 | elif fid == 9:
685 | if ftype == TType.BOOL:
686 | self.enableSingleNoteSharing = iprot.readBool()
687 | else:
688 | iprot.skip(ftype)
689 | elif fid == 10:
690 | if ftype == TType.BOOL:
691 | self.enableSponsoredAccounts = iprot.readBool()
692 | else:
693 | iprot.skip(ftype)
694 | elif fid == 11:
695 | if ftype == TType.BOOL:
696 | self.enableTwitterSharing = iprot.readBool()
697 | else:
698 | iprot.skip(ftype)
699 | elif fid == 12:
700 | if ftype == TType.BOOL:
701 | self.enableLinkedInSharing = iprot.readBool()
702 | else:
703 | iprot.skip(ftype)
704 | elif fid == 13:
705 | if ftype == TType.BOOL:
706 | self.enablePublicNotebooks = iprot.readBool()
707 | else:
708 | iprot.skip(ftype)
709 | elif fid == 16:
710 | if ftype == TType.BOOL:
711 | self.enableGoogle = iprot.readBool()
712 | else:
713 | iprot.skip(ftype)
714 | else:
715 | iprot.skip(ftype)
716 | iprot.readFieldEnd()
717 | iprot.readStructEnd()
718 |
719 | def write(self, oprot):
720 | if oprot._fast_encode is not None and self.thrift_spec is not None:
721 | oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
722 | return
723 | oprot.writeStructBegin('BootstrapSettings')
724 | if self.serviceHost is not None:
725 | oprot.writeFieldBegin('serviceHost', TType.STRING, 1)
726 | oprot.writeString(self.serviceHost.encode('utf-8') if sys.version_info[0] == 2 else self.serviceHost)
727 | oprot.writeFieldEnd()
728 | if self.marketingUrl is not None:
729 | oprot.writeFieldBegin('marketingUrl', TType.STRING, 2)
730 | oprot.writeString(self.marketingUrl.encode('utf-8') if sys.version_info[0] == 2 else self.marketingUrl)
731 | oprot.writeFieldEnd()
732 | if self.supportUrl is not None:
733 | oprot.writeFieldBegin('supportUrl', TType.STRING, 3)
734 | oprot.writeString(self.supportUrl.encode('utf-8') if sys.version_info[0] == 2 else self.supportUrl)
735 | oprot.writeFieldEnd()
736 | if self.accountEmailDomain is not None:
737 | oprot.writeFieldBegin('accountEmailDomain', TType.STRING, 4)
738 | oprot.writeString(self.accountEmailDomain.encode('utf-8') if sys.version_info[0] == 2 else self.accountEmailDomain)
739 | oprot.writeFieldEnd()
740 | if self.enableFacebookSharing is not None:
741 | oprot.writeFieldBegin('enableFacebookSharing', TType.BOOL, 5)
742 | oprot.writeBool(self.enableFacebookSharing)
743 | oprot.writeFieldEnd()
744 | if self.enableGiftSubscriptions is not None:
745 | oprot.writeFieldBegin('enableGiftSubscriptions', TType.BOOL, 6)
746 | oprot.writeBool(self.enableGiftSubscriptions)
747 | oprot.writeFieldEnd()
748 | if self.enableSupportTickets is not None:
749 | oprot.writeFieldBegin('enableSupportTickets', TType.BOOL, 7)
750 | oprot.writeBool(self.enableSupportTickets)
751 | oprot.writeFieldEnd()
752 | if self.enableSharedNotebooks is not None:
753 | oprot.writeFieldBegin('enableSharedNotebooks', TType.BOOL, 8)
754 | oprot.writeBool(self.enableSharedNotebooks)
755 | oprot.writeFieldEnd()
756 | if self.enableSingleNoteSharing is not None:
757 | oprot.writeFieldBegin('enableSingleNoteSharing', TType.BOOL, 9)
758 | oprot.writeBool(self.enableSingleNoteSharing)
759 | oprot.writeFieldEnd()
760 | if self.enableSponsoredAccounts is not None:
761 | oprot.writeFieldBegin('enableSponsoredAccounts', TType.BOOL, 10)
762 | oprot.writeBool(self.enableSponsoredAccounts)
763 | oprot.writeFieldEnd()
764 | if self.enableTwitterSharing is not None:
765 | oprot.writeFieldBegin('enableTwitterSharing', TType.BOOL, 11)
766 | oprot.writeBool(self.enableTwitterSharing)
767 | oprot.writeFieldEnd()
768 | if self.enableLinkedInSharing is not None:
769 | oprot.writeFieldBegin('enableLinkedInSharing', TType.BOOL, 12)
770 | oprot.writeBool(self.enableLinkedInSharing)
771 | oprot.writeFieldEnd()
772 | if self.enablePublicNotebooks is not None:
773 | oprot.writeFieldBegin('enablePublicNotebooks', TType.BOOL, 13)
774 | oprot.writeBool(self.enablePublicNotebooks)
775 | oprot.writeFieldEnd()
776 | if self.enableGoogle is not None:
777 | oprot.writeFieldBegin('enableGoogle', TType.BOOL, 16)
778 | oprot.writeBool(self.enableGoogle)
779 | oprot.writeFieldEnd()
780 | oprot.writeFieldStop()
781 | oprot.writeStructEnd()
782 |
783 | def validate(self):
784 | if self.serviceHost is None:
785 | raise TProtocolException(message='Required field serviceHost is unset!')
786 | if self.marketingUrl is None:
787 | raise TProtocolException(message='Required field marketingUrl is unset!')
788 | if self.supportUrl is None:
789 | raise TProtocolException(message='Required field supportUrl is unset!')
790 | if self.accountEmailDomain is None:
791 | raise TProtocolException(message='Required field accountEmailDomain is unset!')
792 | return
793 |
794 | def __repr__(self):
795 | L = ['%s=%r' % (key, value)
796 | for key, value in self.__dict__.items()]
797 | return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
798 |
799 | def __eq__(self, other):
800 | return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
801 |
802 | def __ne__(self, other):
803 | return not (self == other)
804 |
805 |
806 | class BootstrapProfile(object):
807 | """
808 | This structure describes a collection of bootstrap settings.
809 |
810 | - name:
811 | -
812 | The unique name of the profile, which is guaranteed to remain consistent across
813 | calls to getBootstrapInfo.
814 |
815 | - settings:
816 | -
817 | The settings for this profile.
818 |
819 |
820 |
821 | Attributes:
822 | - name
823 | - settings
824 | """
825 |
826 |
827 | def __init__(self, name=None, settings=None,):
828 | self.name = name
829 | self.settings = settings
830 |
831 | def read(self, iprot):
832 | if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
833 | iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
834 | return
835 | iprot.readStructBegin()
836 | while True:
837 | (fname, ftype, fid) = iprot.readFieldBegin()
838 | if ftype == TType.STOP:
839 | break
840 | if fid == 1:
841 | if ftype == TType.STRING:
842 | self.name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
843 | else:
844 | iprot.skip(ftype)
845 | elif fid == 2:
846 | if ftype == TType.STRUCT:
847 | self.settings = BootstrapSettings()
848 | self.settings.read(iprot)
849 | else:
850 | iprot.skip(ftype)
851 | else:
852 | iprot.skip(ftype)
853 | iprot.readFieldEnd()
854 | iprot.readStructEnd()
855 |
856 | def write(self, oprot):
857 | if oprot._fast_encode is not None and self.thrift_spec is not None:
858 | oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
859 | return
860 | oprot.writeStructBegin('BootstrapProfile')
861 | if self.name is not None:
862 | oprot.writeFieldBegin('name', TType.STRING, 1)
863 | oprot.writeString(self.name.encode('utf-8') if sys.version_info[0] == 2 else self.name)
864 | oprot.writeFieldEnd()
865 | if self.settings is not None:
866 | oprot.writeFieldBegin('settings', TType.STRUCT, 2)
867 | self.settings.write(oprot)
868 | oprot.writeFieldEnd()
869 | oprot.writeFieldStop()
870 | oprot.writeStructEnd()
871 |
872 | def validate(self):
873 | if self.name is None:
874 | raise TProtocolException(message='Required field name is unset!')
875 | if self.settings is None:
876 | raise TProtocolException(message='Required field settings is unset!')
877 | return
878 |
879 | def __repr__(self):
880 | L = ['%s=%r' % (key, value)
881 | for key, value in self.__dict__.items()]
882 | return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
883 |
884 | def __eq__(self, other):
885 | return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
886 |
887 | def __ne__(self, other):
888 | return not (self == other)
889 |
890 |
891 | class BootstrapInfo(object):
892 | """
893 | This structure describes a collection of bootstrap profiles.
894 |
895 | - profiles:
896 | -
897 | List of one or more bootstrap profiles, in descending
898 | preference order.
899 |
900 |
901 |
902 | Attributes:
903 | - profiles
904 | """
905 |
906 |
907 | def __init__(self, profiles=None,):
908 | self.profiles = profiles
909 |
910 | def read(self, iprot):
911 | if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
912 | iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
913 | return
914 | iprot.readStructBegin()
915 | while True:
916 | (fname, ftype, fid) = iprot.readFieldBegin()
917 | if ftype == TType.STOP:
918 | break
919 | if fid == 1:
920 | if ftype == TType.LIST:
921 | self.profiles = []
922 | (_etype3, _size0) = iprot.readListBegin()
923 | for _i4 in range(_size0):
924 | _elem5 = BootstrapProfile()
925 | _elem5.read(iprot)
926 | self.profiles.append(_elem5)
927 | iprot.readListEnd()
928 | else:
929 | iprot.skip(ftype)
930 | else:
931 | iprot.skip(ftype)
932 | iprot.readFieldEnd()
933 | iprot.readStructEnd()
934 |
935 | def write(self, oprot):
936 | if oprot._fast_encode is not None and self.thrift_spec is not None:
937 | oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
938 | return
939 | oprot.writeStructBegin('BootstrapInfo')
940 | if self.profiles is not None:
941 | oprot.writeFieldBegin('profiles', TType.LIST, 1)
942 | oprot.writeListBegin(TType.STRUCT, len(self.profiles))
943 | for iter6 in self.profiles:
944 | iter6.write(oprot)
945 | oprot.writeListEnd()
946 | oprot.writeFieldEnd()
947 | oprot.writeFieldStop()
948 | oprot.writeStructEnd()
949 |
950 | def validate(self):
951 | if self.profiles is None:
952 | raise TProtocolException(message='Required field profiles is unset!')
953 | return
954 |
955 | def __repr__(self):
956 | L = ['%s=%r' % (key, value)
957 | for key, value in self.__dict__.items()]
958 | return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
959 |
960 | def __eq__(self, other):
961 | return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
962 |
963 | def __ne__(self, other):
964 | return not (self == other)
965 | all_structs.append(PublicUserInfo)
966 | PublicUserInfo.thrift_spec = (
967 | None, # 0
968 | (1, TType.I32, 'userId', None, None, ), # 1
969 | None, # 2
970 | None, # 3
971 | (4, TType.STRING, 'username', 'UTF8', None, ), # 4
972 | (5, TType.STRING, 'noteStoreUrl', 'UTF8', None, ), # 5
973 | (6, TType.STRING, 'webApiUrlPrefix', 'UTF8', None, ), # 6
974 | (7, TType.I32, 'serviceLevel', None, None, ), # 7
975 | )
976 | all_structs.append(UserUrls)
977 | UserUrls.thrift_spec = (
978 | None, # 0
979 | (1, TType.STRING, 'noteStoreUrl', 'UTF8', None, ), # 1
980 | (2, TType.STRING, 'webApiUrlPrefix', 'UTF8', None, ), # 2
981 | (3, TType.STRING, 'userStoreUrl', 'UTF8', None, ), # 3
982 | (4, TType.STRING, 'utilityUrl', 'UTF8', None, ), # 4
983 | (5, TType.STRING, 'messageStoreUrl', 'UTF8', None, ), # 5
984 | (6, TType.STRING, 'userWebSocketUrl', 'UTF8', None, ), # 6
985 | )
986 | all_structs.append(AuthenticationResult)
987 | AuthenticationResult.thrift_spec = (
988 | None, # 0
989 | (1, TType.I64, 'currentTime', None, None, ), # 1
990 | (2, TType.STRING, 'authenticationToken', 'UTF8', None, ), # 2
991 | (3, TType.I64, 'expiration', None, None, ), # 3
992 | (4, TType.STRUCT, 'user', [evernote.edam.type.ttypes.User, None], None, ), # 4
993 | (5, TType.STRUCT, 'publicUserInfo', [PublicUserInfo, None], None, ), # 5
994 | (6, TType.STRING, 'noteStoreUrl', 'UTF8', None, ), # 6
995 | (7, TType.STRING, 'webApiUrlPrefix', 'UTF8', None, ), # 7
996 | (8, TType.BOOL, 'secondFactorRequired', None, None, ), # 8
997 | (9, TType.STRING, 'secondFactorDeliveryHint', 'UTF8', None, ), # 9
998 | (10, TType.STRUCT, 'urls', [UserUrls, None], None, ), # 10
999 | )
1000 | all_structs.append(BootstrapSettings)
1001 | BootstrapSettings.thrift_spec = (
1002 | None, # 0
1003 | (1, TType.STRING, 'serviceHost', 'UTF8', None, ), # 1
1004 | (2, TType.STRING, 'marketingUrl', 'UTF8', None, ), # 2
1005 | (3, TType.STRING, 'supportUrl', 'UTF8', None, ), # 3
1006 | (4, TType.STRING, 'accountEmailDomain', 'UTF8', None, ), # 4
1007 | (5, TType.BOOL, 'enableFacebookSharing', None, None, ), # 5
1008 | (6, TType.BOOL, 'enableGiftSubscriptions', None, None, ), # 6
1009 | (7, TType.BOOL, 'enableSupportTickets', None, None, ), # 7
1010 | (8, TType.BOOL, 'enableSharedNotebooks', None, None, ), # 8
1011 | (9, TType.BOOL, 'enableSingleNoteSharing', None, None, ), # 9
1012 | (10, TType.BOOL, 'enableSponsoredAccounts', None, None, ), # 10
1013 | (11, TType.BOOL, 'enableTwitterSharing', None, None, ), # 11
1014 | (12, TType.BOOL, 'enableLinkedInSharing', None, None, ), # 12
1015 | (13, TType.BOOL, 'enablePublicNotebooks', None, None, ), # 13
1016 | None, # 14
1017 | None, # 15
1018 | (16, TType.BOOL, 'enableGoogle', None, None, ), # 16
1019 | )
1020 | all_structs.append(BootstrapProfile)
1021 | BootstrapProfile.thrift_spec = (
1022 | None, # 0
1023 | (1, TType.STRING, 'name', 'UTF8', None, ), # 1
1024 | (2, TType.STRUCT, 'settings', [BootstrapSettings, None], None, ), # 2
1025 | )
1026 | all_structs.append(BootstrapInfo)
1027 | BootstrapInfo.thrift_spec = (
1028 | None, # 0
1029 | (1, TType.LIST, 'profiles', (TType.STRUCT, [BootstrapProfile, None], False), None, ), # 1
1030 | )
1031 | fix_spec(all_structs)
1032 | del all_structs
1033 |
--------------------------------------------------------------------------------