#!/usr/bin/env python
import json

import falcon

from email.utils import formatdate

# resource endpoints

class JSONResource(object):
    def on_get(self, request, response):
        response.set_header('Date', formatdate(timeval=None, localtime=False, usegmt=True))
        json_data = {'message': "Hello, world!"}
        response.body = json.dumps(json_data)


class PlaintextResource(object):
    def on_get(self, request, response):
        response.set_header('Date', formatdate(timeval=None, localtime=False, usegmt=True))
        response.set_header('Content-Type', 'text/plain')
        response.body = b'Hello, world!'

# setup

app = falcon.API()
app.add_route("/json", JSONResource())
app.add_route("/plaintext", PlaintextResource())

# entry point for debugging
if __name__ == "__main__":
    from wsgiref import simple_server

    httpd = simple_server.make_server('localhost', 8080, app)
    httpd.serve_forever()

f7d22ca7ec2f03212aa9ca30dd22ad7303cb5885
<mask token>


class JSONResource(object):
    <mask token>


class PlaintextResource(object):

    def on_get(self, request, response):
        response.set_header('Date', formatdate(timeval=None, localtime=
            False, usegmt=True))
        response.set_header('Content-Type', 'text/plain')
        response.body = b'Hello, world!'


<mask token>

<mask token>


class JSONResource(object):

    def on_get(self, request, response):
        response.set_header('Date', formatdate(timeval=None, localtime=
            False, usegmt=True))
        json_data = {'message': 'Hello, world!'}
        response.body = json.dumps(json_data)


class PlaintextResource(object):

    def on_get(self, request, response):
        response.set_header('Date', formatdate(timeval=None, localtime=
            False, usegmt=True))
        response.set_header('Content-Type', 'text/plain')
        response.body = b'Hello, world!'


<mask token>
app.add_route('/json', JSONResource())
app.add_route('/plaintext', PlaintextResource())
if __name__ == '__main__':
    from wsgiref import simple_server
    httpd = simple_server.make_server('localhost', 8080, app)
    httpd.serve_forever()

<mask token>


class JSONResource(object):

    def on_get(self, request, response):
        response.set_header('Date', formatdate(timeval=None, localtime=
            False, usegmt=True))
        json_data = {'message': 'Hello, world!'}
        response.body = json.dumps(json_data)


class PlaintextResource(object):

    def on_get(self, request, response):
        response.set_header('Date', formatdate(timeval=None, localtime=
            False, usegmt=True))
        response.set_header('Content-Type', 'text/plain')
        response.body = b'Hello, world!'


app = falcon.API()
app.add_route('/json', JSONResource())
app.add_route('/plaintext', PlaintextResource())
if __name__ == '__main__':
    from wsgiref import simple_server
    httpd = simple_server.make_server('localhost', 8080, app)
    httpd.serve_forever()

import json
import falcon
from email.utils import formatdate


class JSONResource(object):

    def on_get(self, request, response):
        response.set_header('Date', formatdate(timeval=None, localtime=
            False, usegmt=True))
        json_data = {'message': 'Hello, world!'}
        response.body = json.dumps(json_data)


class PlaintextResource(object):

    def on_get(self, request, response):
        response.set_header('Date', formatdate(timeval=None, localtime=
            False, usegmt=True))
        response.set_header('Content-Type', 'text/plain')
        response.body = b'Hello, world!'


app = falcon.API()
app.add_route('/json', JSONResource())
app.add_route('/plaintext', PlaintextResource())
if __name__ == '__main__':
    from wsgiref import simple_server
    httpd = simple_server.make_server('localhost', 8080, app)
    httpd.serve_forever()

#!/usr/bin/env python
import json

import falcon

from email.utils import formatdate

# resource endpoints

class JSONResource(object):
    def on_get(self, request, response):
        response.set_header('Date', formatdate(timeval=None, localtime=False, usegmt=True))
        json_data = {'message': "Hello, world!"}
        response.body = json.dumps(json_data)


class PlaintextResource(object):
    def on_get(self, request, response):
        response.set_header('Date', formatdate(timeval=None, localtime=False, usegmt=True))
        response.set_header('Content-Type', 'text/plain')
        response.body = b'Hello, world!'

# setup

app = falcon.API()
app.add_route("/json", JSONResource())
app.add_route("/plaintext", PlaintextResource())

# entry point for debugging
if __name__ == "__main__":
    from wsgiref import simple_server

    httpd = simple_server.make_server('localhost', 8080, app)
    httpd.serve_forever()
