|
1 | 1 | #!/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 | | -# |
35 | 2 |
|
36 | 3 | import time |
37 | 4 | from flask import Flask, url_for, session, request, redirect, Response |
@@ -78,4 +45,7 @@ def login_callback(): |
78 | 45 | return token |
79 | 46 |
|
80 | 47 | 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 | + |
81 | 51 | app.run(host='0.0.0.0', port=5555) |
0 commit comments