<s> """<STR_LIT>""" <EOL> from flask import Flask <EOL> from flask . ext . restless import APIManager , Resource <EOL> from flapi . models import session , Audio <EOL> app = Flask ( __name__ ) <EOL> class SongResource ( Resource ) : <EOL> """<STR_LIT>""" <EOL> def create ( self ) : <EOL> pass <EOL> def read ( self , id = None , ids_only = False , nesting_levels = <NUM_LIT:1> ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def update ( self , * args , ** kwargs ) : <EOL> pass <EOL> def delete ( self , id ) : <EOL> pass <EOL> def patch ( self ) : <EOL> pass <EOL> def head ( self ) : <EOL> pass <EOL> def options ( self ) : <EOL> pass <EOL> def connect ( self ) : <EOL> raise NotImplementedError <EOL> def trace ( self ) : <EOL> raise NotImplementedError <EOL> def validator ( self , data ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def authorize ( self ) : <EOL> pass <EOL> def get_format ( self ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError <EOL> class SongResource ( Resource ) : <EOL> """<STR_LIT>""" <EOL> __basemodel__ = Audio <EOL> __resource__ = '<STR_LIT>' <EOL> @ method ( '<STR_LIT:GET>' ) <EOL> def get_all_or_one ( self , id = None ) : <EOL> pass <EOL> @ method ( [ '<STR_LIT:POST>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def write ( self , data ) : <EOL> pass <EOL> def authorize ( self ) : <EOL> pass <EOL> def get_format ( self ) : <EOL> pass <EOL> @ app . route ( '<STR_LIT>' ) <EOL> class SongResource ( Resource ) : <EOL> pass <EOL> app . add_url_rule ( '<STR_LIT>' , '<STR_LIT>' , SongResource ) <EOL> app . add_url_rule ( '<STR_LIT>' , '<STR_LIT>' , SongResource ) <EOL> SongResource . create_rules ( app ) <EOL> api = APIManager ( app , session = session ) <EOL> api . resources ( [ SongResource , ArtistResouce , SomeOtherResource ] ) <EOL> api . create_rules ( app ) <EOL> api = APIManager ( app , session = session ) <EOL> @ api . resource ( '<STR_LIT>' ) <EOL> def songs ( song_id = None ) : <EOL> pass <EOL> @ songs . method ( '<STR_LIT>' ) <EOL> def save_song ( data ) : <EOL> pass <EOL> @ songs . authorize <EOL> def check_permissions ( ) : <EOL> pass <EOL> @ songs . get_format <EOL> def get_format ( ) : <EOL> pass <EOL> api . resource ( Audio , methods = [ '<STR_LIT:GET>' , '<STR_LIT:POST>' , '<STR_LIT>' ] ) <EOL> class RootResource ( object ) : <EOL> """<STR_LIT:U+0020>""" <EOL> __name__ = '<STR_LIT>' <EOL> __parent__ = None <EOL> class SongResource ( object ) : <EOL> """<STR_LIT:U+0020>""" <EOL> def __resource_url__ ( self ) : <EOL> from flask import request <EOL> return request . base_url <EOL> from flask . ext . restless import inside , lineage , find_root <EOL> class Thing ( object ) : <EOL> pass <EOL> a = Thing ( ) <EOL> b = Thing ( ) <EOL> b . __parent__ = a <EOL> inside ( b , a ) <EOL> inside ( a , b ) <EOL> list ( lineage ( b ) ) <EOL> find_root ( b ) <EOL> manager = APIManager ( app , session = session ) <EOL> manager . create_api ( Audio , methods = [ '<STR_LIT:GET>' , '<STR_LIT:POST>' , '<STR_LIT>' ] ) <EOL> """<STR_LIT>""" </s>
