<s> from flask_restful import Api <EOL> from lingobarter . core . app import LingobarterModule <EOL> class LingobarterApi ( Api ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , app , version ) : <EOL> """<STR_LIT>""" <EOL> self . name = '<STR_LIT>' + str ( version ) <EOL> super ( LingobarterApi , self ) . __init__ ( app = app , prefix = '<STR_LIT>' + str ( version ) , catch_all_404s = True ) <EOL> def add_lingobarter_resource ( self , resource , * urls , ** kwargs ) : <EOL> endpoint = kwargs . get ( '<STR_LIT>' , None ) <EOL> if endpoint is None : <EOL> endpoint = self . name + '<STR_LIT:.>' + resource . __name__ . lower ( ) <EOL> if not endpoint . startswith ( self . name ) : <EOL> endpoint = self . name + '<STR_LIT:.>' + endpoint <EOL> kwargs [ '<STR_LIT>' ] = endpoint <EOL> self . add_resource ( resource , * urls , ** kwargs ) </s>
