def on_post(self, req: Request, res: Response): twilio_message = TwilioMessage.apply(req.params) if twilio_message.is_song_request: song_request = twilio_message.extract_song() spotify_uri = SpotifySongFinder.lucky_find( artist=song_request.artist, track=song_request.title) song_request.uri = spotify_uri AwsServices.add(**song_request.to_kwargs()) self.twilio_reply(to=twilio_message.msg_from) res.status = falcon.HTTP_CREATED else: res.status = falcon.HTTP_BAD_REQUEST res.content_type = MEDIA_XML res.body = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>' \ '<Response></Response>'
def on_get(self, req: Request, res: Response): res.body = "All good!" res.content_type = MEDIA_TEXT