Skip to content

Instantly share code, notes, and snippets.

@dsuch
Created October 27, 2013 17:33
Show Gist options
  • Select an option

  • Save dsuch/7185428 to your computer and use it in GitHub Desktop.

Select an option

Save dsuch/7185428 to your computer and use it in GitHub Desktop.
Sample usage of HTMLService
# -*- 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