Skip to content

Commit eca588d

Browse files
committed
added LOCAL_TOKEN.
1 parent fde7a05 commit eca588d

File tree

3 files changed

+6
-34
lines changed

3 files changed

+6
-34
lines changed

tests/credentials.py.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
APP_ID = 'APP ID'
22
APP_SECRET = 'APP SECRET'
3+
LOCAL_ACCESS_TOKEN = 'local' # The access token to a local account (i.e: running on your machine).

tests/oauth.py

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,4 @@
11
#!/usr/bin/env python
2-
#
3-
# This demo app shows how to use the Nylas client to authenticate against
4-
# the Nylas API and how to fetch emails from an authenticated account.
5-
#
6-
# NOTE: This app does NOT use SSL. Before deploying this code to a
7-
# server environment, you should ENABLE SSL to avoid exposing your API
8-
# access token in plaintext.
9-
#
10-
# To run this demo app:
11-
# 1. Save this file to your computer as `server.py`
12-
#
13-
# 2. In the Nylas Developer Portal, create a new application. Replace the
14-
# APP_ID and APP_SECRET variables below with the App ID and App
15-
# Secret of your application.
16-
# https://nylas.com/
17-
#
18-
# 3. In the Nylas Developer Portal, edit your application and add the
19-
# callback URL: http://localhost:8888/login_callback
20-
#
21-
# 4. On the command line, `cd` to the folder where you saved the file
22-
#
23-
# 5. On the command line, run `python ./server.py`
24-
# - You may need to install Python: https://www.python.org/download/
25-
# - You may need to install dependencies using pip:
26-
# (http://pip.readthedocs.org/en/latest/installing.html)
27-
# pip install nylas flask requests
28-
# - Note: You may want to set up a virtualenv to isolate these
29-
# dependencies from other packages on your system. Otherwise, you
30-
# will need to sudo pip install, to install them globally.
31-
# http://docs.python-guide.org/en/latest/dev/virtualenvs/
32-
#
33-
# 6. In the browser, visit http://localhost:8888/
34-
#
352

363
import time
374
from flask import Flask, url_for, session, request, redirect, Response
@@ -78,4 +45,7 @@ def login_callback():
7845
return token
7946

8047
if __name__ == '__main__':
48+
print "\033[94mOauth self-test. Please browse to http://localhost:5555 and make\033[0m"
49+
print "\033[94msure that you're seeing a valid API token.\033[0m"
50+
8151
app.run(host='0.0.0.0', port=5555)

tests/system.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
from nylas import APIClient
77
from nylas.client.restful_models import Label, Folder
88
from nylas.client.errors import *
9+
from credentials import LOCAL_ACCESS_TOKEN
910

10-
client = APIClient(None, None, access_token="1qqlrm3m82toh86nevz0o1l24", api_server='http://localhost:5555')
11+
client = APIClient(None, None, access_token=LOCAL_ACCESS_TOKEN, api_server='http://localhost:5555')
1112

1213
count = 0
1314

0 commit comments

Comments
 (0)