<s> """<STR_LIT>""" <EOL> from flask import Flask <EOL> from flask . views import MethodView <EOL> from flask . ext import restful <EOL> from flask . ext . via import Via <EOL> from flask . ext . via . routers . default import Functional , Pluggable <EOL> from flask . ext . via . routers . restful import Resource <EOL> class FooView ( MethodView ) : <EOL> def get ( self , bar = None ) : <EOL> rtn = '<STR_LIT>' <EOL> if bar : <EOL> rtn += '<STR_LIT>' . format ( bar ) <EOL> return rtn <EOL> class FooResource ( restful . Resource ) : <EOL> def get ( self , bar = None ) : <EOL> rtn = { '<STR_LIT>' : '<STR_LIT:foo>' } <EOL> if bar : <EOL> rtn [ '<STR_LIT:bar>' ] = bar <EOL> return rtn <EOL> def foo ( bar = None ) : <EOL> rtn = '<STR_LIT>' <EOL> if bar : <EOL> rtn += '<STR_LIT>' . format ( bar ) <EOL> return rtn <EOL> app = Flask ( __name__ ) <EOL> api = restful . Api ( app ) <EOL> routes = [ <EOL> Functional ( '<STR_LIT>' , foo ) , <EOL> Functional ( '<STR_LIT>' , foo , endpoint = '<STR_LIT>' ) , <EOL> Pluggable ( '<STR_LIT>' , FooView , '<STR_LIT>' ) , <EOL> Pluggable ( '<STR_LIT>' , FooView , '<STR_LIT>' ) , <EOL> Resource ( '<STR_LIT>' , FooResource , '<STR_LIT>' ) , <EOL> Resource ( '<STR_LIT>' , FooResource , endpoint = '<STR_LIT>' ) <EOL> ] <EOL> via = Via ( ) <EOL> via . init_app ( <EOL> app , <EOL> routes_module = '<STR_LIT>' , <EOL> restful_api = api ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> app . run ( debug = True ) </s>
