Created
October 27, 2013 17:33
-
-
Save dsuch/7185428 to your computer and use it in GitHub Desktop.
Sample usage of HTMLService
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| from html_service import HTMLService | |
| TEMPLATE = """<!doctype html> | |
| <html> | |
| <head> | |
| <title>Sample HTML template</title> | |
| </head> | |
| <body> | |
| <h1>{{ header }}</h1> | |
| <ul> | |
| {% for customer in customers %} | |
| <li>{{ customer }}</li> | |
| {% endfor %} | |
| </ul> | |
| </body> | |
| </html> | |
| """ | |
| class MyService(HTMLService): | |
| def handle(self): | |
| ctx = { | |
| 'header': 'Customer list', | |
| 'customers': ['李賁', 'John Doe', 'José Díaz'] | |
| } | |
| self.generate_payload(ctx, TEMPLATE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment