forked from docusign/code-examples-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
106 lines (93 loc) · 3.7 KB
/
__init__.py
File metadata and controls
106 lines (93 loc) · 3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import os
from flask import Flask
from flask_wtf.csrf import CSRFProtect
from .ds_config import DS_CONFIG
from .eSignature import examples
from .docusign.views import ds
from .ds_config import EXAMPLES_API_TYPE
from .rooms import examples as rooms_examples
from .click import examples as click_examples
from .monitor import examples as monitor_examples
from .views import core
session_path = "/tmp/python_recipe_sessions"
if EXAMPLES_API_TYPE["Rooms"]:
app = Flask(__name__, template_folder="rooms/templates")
elif EXAMPLES_API_TYPE["Click"]:
app = Flask(__name__, template_folder="click/templates")
elif EXAMPLES_API_TYPE["Monitor"]:
app = Flask(__name__, template_folder="monitor/templates")
else:
app = Flask(__name__)
app.config.from_pyfile("config.py")
# See https://flask-wtf.readthedocs.io/en/stable/csrf.html
csrf = CSRFProtect(app)
# Set whether this is a quickstart in config
#app.config["quickstart"] = DS_CONFIG["quickstart"]
# Set whether user has logged in
#app.config["isLoggedIn"] = False
# Register home page
app.register_blueprint(core)
# Register OAuth
app.register_blueprint(ds)
# Register examples
if EXAMPLES_API_TYPE["Rooms"]:
app.register_blueprint(rooms_examples.eg001Rooms)
app.register_blueprint(rooms_examples.eg002)
app.register_blueprint(rooms_examples.eg003)
app.register_blueprint(rooms_examples.eg004)
app.register_blueprint(rooms_examples.eg005)
app.register_blueprint(rooms_examples.eg006)
app.register_blueprint(rooms_examples.eg007)
app.register_blueprint(rooms_examples.eg008)
app.register_blueprint(rooms_examples.eg009)
elif EXAMPLES_API_TYPE["Monitor"]:
app.register_blueprint(monitor_examples.eg001)
elif EXAMPLES_API_TYPE["Click"]:
app.register_blueprint(click_examples.eg001)
app.register_blueprint(click_examples.eg002)
app.register_blueprint(click_examples.eg003)
app.register_blueprint(click_examples.eg004)
app.register_blueprint(click_examples.eg005)
else:
app.register_blueprint(examples.eg001)
app.register_blueprint(examples.eg002)
app.register_blueprint(examples.eg003)
app.register_blueprint(examples.eg004)
app.register_blueprint(examples.eg005)
app.register_blueprint(examples.eg006)
app.register_blueprint(examples.eg007)
app.register_blueprint(examples.eg008)
app.register_blueprint(examples.eg009)
app.register_blueprint(examples.eg010)
app.register_blueprint(examples.eg011)
app.register_blueprint(examples.eg012)
app.register_blueprint(examples.eg013)
app.register_blueprint(examples.eg014)
app.register_blueprint(examples.eg015)
app.register_blueprint(examples.eg016)
app.register_blueprint(examples.eg017)
app.register_blueprint(examples.eg018)
app.register_blueprint(examples.eg019)
app.register_blueprint(examples.eg020)
app.register_blueprint(examples.eg021)
app.register_blueprint(examples.eg022)
app.register_blueprint(examples.eg023)
app.register_blueprint(examples.eg024)
app.register_blueprint(examples.eg025)
app.register_blueprint(examples.eg026)
app.register_blueprint(examples.eg027)
app.register_blueprint(examples.eg028)
app.register_blueprint(examples.eg029)
app.register_blueprint(examples.eg030)
app.register_blueprint(examples.eg031)
app.register_blueprint(examples.eg032)
app.register_blueprint(examples.eg033)
app.register_blueprint(examples.eg034)
app.register_blueprint(examples.eg035)
if "DYNO" in os.environ: # On Heroku?
import logging
stream_handler = logging.StreamHandler()
app.logger.addHandler(stream_handler)
app.logger.setLevel(logging.INFO)
app.logger.info("Recipe example startup")
app.config.update(dict(PREFERRED_URL_SCHEME="https"))