<s> from twilio . rest . resources . notifications import Notifications <EOL> from twilio . rest . resources . recordings import Recordings <EOL> from twilio . rest . resources . util import normalize_dates , parse_date <EOL> from twilio . rest . resources import InstanceResource , ListResource <EOL> class Call ( InstanceResource ) : <EOL> """<STR_LIT>""" <EOL> BUSY = "<STR_LIT>" <EOL> CANCELED = "<STR_LIT>" <EOL> COMPLETED = "<STR_LIT>" <EOL> FAILED = "<STR_LIT>" <EOL> IN_PROGRESS = "<STR_LIT>" <EOL> NO_ANSWER = "<STR_LIT>" <EOL> QUEUED = "<STR_LIT>" <EOL> RINGING = "<STR_LIT>" <EOL> subresources = [ <EOL> Notifications , <EOL> Recordings , <EOL> ] <EOL> def hangup ( self ) : <EOL> """<STR_LIT>""" <EOL> a = self . parent . hangup ( self . name ) <EOL> self . load ( a . __dict__ ) <EOL> def cancel ( self ) : <EOL> """<STR_LIT>""" <EOL> a = self . parent . cancel ( self . name ) <EOL> self . load ( a . __dict__ ) <EOL> def route ( self , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> a = self . parent . route ( self . name , ** kwargs ) <EOL> self . load ( a . __dict__ ) <EOL> class Calls ( ListResource ) : <EOL> """<STR_LIT>""" <EOL> name = "<STR_LIT>" <EOL> instance = Call <EOL> @ normalize_dates <EOL> def list ( self , from_ = None , ended_after = None , <EOL> ended_before = None , ended = None , started_before = None , <EOL> started_after = None , started = None , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> kwargs [ "<STR_LIT>" ] = from_ <EOL> kwargs [ "<STR_LIT>" ] = started_before <EOL> kwargs [ "<STR_LIT>" ] = started_after <EOL> kwargs [ "<STR_LIT>" ] = parse_date ( started ) <EOL> kwargs [ "<STR_LIT>" ] = ended_before <EOL> kwargs [ "<STR_LIT>" ] = ended_after <EOL> kwargs [ "<STR_LIT>" ] = parse_date ( ended ) <EOL> return self . get_instances ( kwargs ) <EOL> def create ( self , to , from_ , url , status_method = None , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> kwargs [ "<STR_LIT>" ] = from_ <EOL> kwargs [ "<STR_LIT:to>" ] = to <EOL> kwargs [ "<STR_LIT:url>" ] = url <EOL> kwargs [ "<STR_LIT>" ] = status_method <EOL> return self . create_instance ( kwargs ) <EOL> def update ( self , sid , ** kwargs ) : <EOL> return self . update_instance ( sid , kwargs ) <EOL> def cancel ( self , sid ) : <EOL> """<STR_LIT>""" <EOL> return self . update ( sid , status = Call . CANCELED ) <EOL> def hangup ( self , sid ) : <EOL> """<STR_LIT>""" <EOL> return self . update ( sid , status = Call . COMPLETED ) <EOL> def route ( self , sid , url , method = "<STR_LIT:POST>" ) : <EOL> """<STR_LIT>""" <EOL> return self . update ( sid , url = url , method = method ) </s>
