-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHow_to_Activate_the_Product.py
36 lines (27 loc) · 1.5 KB
/
How_to_Activate_the_Product.py
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
from flask import Blueprint, request, url_for
from stimulsoft_reports import StiLicense
from stimulsoft_reports.report import StiReport
from stimulsoft_reports.viewer import StiViewer
How_to_Activate_the_Product = app = Blueprint('How_to_Activate_the_Product', __name__)
@app.route('/How_to_Activate_the_Product', methods = ['GET', 'POST'])
def index():
# Creating a viewer object
viewer = StiViewer()
viewer.javascript.appendHead('<link rel="shortcut icon" href="' + url_for('static', filename = 'favicon.ico') + '" type="image/x-icon">')
# If the request processing was successful, you need to return the result to the client side
if viewer.processRequest(request):
return viewer.getFrameworkResponse()
# You can use one of the methods below to register your license key
# StiLicense.setFile(url_for('static', filename='private/license.key'))
# StiLicense.setKey('6vJhGtLLLz2GNviWmUTrhSqnO...')
# Creating a report object
report = StiReport()
# Loading a dashboard by URL
# This method does not load the report object on the server side, it only generates the necessary JavaScript code
# The dashboard will be loaded into a JavaScript object on the client side
reportUrl = url_for('static', filename = 'reports/WebsiteAnalytics.mrt')
report.loadFile(reportUrl)
# Assigning a report object to the viewer
viewer.report = report
# Displaying the visual part of the viewer as a prepared HTML page
return viewer.getFrameworkResponse()