用于python的evernote sdk
evernote的Python项目详细描述
Evernote Python的sdk
===
Evernote API版本1.25
此sdk用于Python 2.x
Evernote的Beta Python 3 sdk请参见https://github.com/evernote/evernote-sdk-python3
概述dk包含用于从python调用evernote云api的包装器代码。
sdk还包含一个示例脚本。代码演示了sdk对单用户脚本的基本使用。真正的Web应用程序必须使用OAuth对Evernote服务进行身份验证。
先决条件
----
要使用此sdk中的代码,您需要从http://dev.evernote.com/documentation/cloud获取API密钥。您还可以在该页面上找到完整的api文档。
要运行示例代码,您需要在沙盒服务上有一个用户帐户,以便在其中进行开发。在https://sandbox.evernote.com/registration.action
注册一个帐户以运行客户端示例代码,您需要一个开发人员令牌。在https://sandbox.evernote.com/api/developerToken.action
Getting Started-client
----
"sample/client/edamtest.py"中的代码演示了使用evernote API的基础知识,使用开发人员令牌简化身份验证过程学习。打开"sample/client/edamtest.py"
2。向下滚动并填写Evernote开发者代币。
3.在命令行上,运行以下命令来执行脚本:
``bash
$export pythonpath=../../lib;python edamtest.py
````
Getting Started-django with oauth
--------
web应用程序必须使用oauth进行身份验证为Evernote服务。sample/django中的代码包含一个演示oauth身份验证过程的简单web应用程序。应用程序使用django框架。您不需要对应用程序使用django,但需要它来运行示例代码。
1。安装"django"、"oauth2"和"evernote"库。您还可以将'requirements.txt'用于'pip'。
2.打开文件"oauth/views.py"
3。填写Evernote API用户密钥和密码。
4.在命令行上,运行以下命令启动示例应用程序:
``bash
$python manage.py runserver
````
5。在浏览器中打开示例应用程序:`http://localhost:8000`
在命令行上使用pip安装示例项目,如下所示。
``bash
$pip install-e.
````
2.打开文件"development.ini"
3。填写Evernote API用户密钥和密码。
4.在命令行上,运行以下命令启动示例应用程序:
``bash
$pserve development.ini
````
5。在浏览器中打开示例应用程序:`http://localhost:6543`
用法
----
``python
client=evernoteclient(
consumer\'your consumer key',
consumer\'your consumer secret',
sandbox=trueken=client.get_request_token('your callback url')
客户端.get_authorize_url(request_token)
=>;https://sandbox.evernote.com/oauth.action?oauth_token=oauth_token
```
``python
``access_token=client.get_access_token(
request_token['oauth_token',
request_token['oauth_secret',
request.get('oauth_verifier','')
````
现在可以进行其他api调用s
`` python
client=evernoteclient(token=access_token)
note_store=client.get_note_store()
notes=note_store.listnotebooks()
````
###userstore一旦获得令牌,就可以使用userstore。例如,如果要调用user store.get user:
`` python
client=evernoteclient(token=access_token)
user_store=client.get_user_store()
user_store.getuser()
````
可以在userstore函数的参数中省略authenticationtoken。
如果如果要获取链接笔记本的标记,请调用note store.listlinkoteboo:
``python
note`store=client.get`note`store()
```
``notestore.listlinkotebooks()[0]
共享的笔记存储=客户端。get shared notestore(链接的笔记存储)
共享的笔记存储=共享的笔记存储。getsharednotebookbyauth()
共享的笔记存储。listtagsbynotebook(共享的笔记存储。notebookguid)
``
商业帐户中的帐簿:
``python
business_note_store=client.get_business_note_store()
business_note_store.listnobets()
```
-api文档:http://dev.evernote.com/documentation/reference/
已知问题
----
__正则表达式
通常,["re"regex模块](http://docs.python.org/2/library/re.html)不处理[限制]中的某些正则表达式(https://github.com/evernote/evernote-sdk-python/blob/master/lib/eveimits/constants.py),但是[re2](https://pypi.python.org/pypi/re2/)可以。
===
Evernote API版本1.25
此sdk用于Python 2.x
Evernote的Beta Python 3 sdk请参见https://github.com/evernote/evernote-sdk-python3
概述dk包含用于从python调用evernote云api的包装器代码。
sdk还包含一个示例脚本。代码演示了sdk对单用户脚本的基本使用。真正的Web应用程序必须使用OAuth对Evernote服务进行身份验证。
先决条件
----
要使用此sdk中的代码,您需要从http://dev.evernote.com/documentation/cloud获取API密钥。您还可以在该页面上找到完整的api文档。
要运行示例代码,您需要在沙盒服务上有一个用户帐户,以便在其中进行开发。在https://sandbox.evernote.com/registration.action
注册一个帐户以运行客户端示例代码,您需要一个开发人员令牌。在https://sandbox.evernote.com/api/developerToken.action
Getting Started-client
----
"sample/client/edamtest.py"中的代码演示了使用evernote API的基础知识,使用开发人员令牌简化身份验证过程学习。打开"sample/client/edamtest.py"
2。向下滚动并填写Evernote开发者代币。
3.在命令行上,运行以下命令来执行脚本:
``bash
$export pythonpath=../../lib;python edamtest.py
````
Getting Started-django with oauth
--------
web应用程序必须使用oauth进行身份验证为Evernote服务。sample/django中的代码包含一个演示oauth身份验证过程的简单web应用程序。应用程序使用django框架。您不需要对应用程序使用django,但需要它来运行示例代码。
1。安装"django"、"oauth2"和"evernote"库。您还可以将'requirements.txt'用于'pip'。
2.打开文件"oauth/views.py"
3。填写Evernote API用户密钥和密码。
4.在命令行上,运行以下命令启动示例应用程序:
``bash
$python manage.py runserver
````
5。在浏览器中打开示例应用程序:`http://localhost:8000`
在命令行上使用pip安装示例项目,如下所示。
``bash
$pip install-e.
````
2.打开文件"development.ini"
3。填写Evernote API用户密钥和密码。
4.在命令行上,运行以下命令启动示例应用程序:
``bash
$pserve development.ini
````
5。在浏览器中打开示例应用程序:`http://localhost:6543`
用法
----
``python
client=evernoteclient(
consumer\'your consumer key',
consumer\'your consumer secret',
sandbox=trueken=client.get_request_token('your callback url')
客户端.get_authorize_url(request_token)
=>;https://sandbox.evernote.com/oauth.action?oauth_token=oauth_token
```
``python
``access_token=client.get_access_token(
request_token['oauth_token',
request_token['oauth_secret',
request.get('oauth_verifier','')
````
现在可以进行其他api调用s
`` python
client=evernoteclient(token=access_token)
note_store=client.get_note_store()
notes=note_store.listnotebooks()
````
###userstore一旦获得令牌,就可以使用userstore。例如,如果要调用user store.get user:
`` python
client=evernoteclient(token=access_token)
user_store=client.get_user_store()
user_store.getuser()
````
可以在userstore函数的参数中省略authenticationtoken。
如果如果要获取链接笔记本的标记,请调用note store.listlinkoteboo:
``python
note`store=client.get`note`store()
```
``notestore.listlinkotebooks()[0]
共享的笔记存储=客户端。get shared notestore(链接的笔记存储)
共享的笔记存储=共享的笔记存储。getsharednotebookbyauth()
共享的笔记存储。listtagsbynotebook(共享的笔记存储。notebookguid)
``
商业帐户中的帐簿:
``python
business_note_store=client.get_business_note_store()
business_note_store.listnobets()
```
已知问题
----
__正则表达式
通常,["re"regex模块](http://docs.python.org/2/library/re.html)不处理[限制]中的某些正则表达式(https://github.com/evernote/evernote-sdk-python/blob/master/lib/eveimits/constants.py),但是[re2](https://pypi.python.org/pypi/re2/)可以。