Skip to content

Instantly share code, notes, and snippets.

@sjwaight
Last active August 26, 2021 08:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjwaight/3985ff28fb6b42f5896d183243dea934 to your computer and use it in GitHub Desktop.
Save sjwaight/3985ff28fb6b42f5896d183243dea934 to your computer and use it in GitHub Desktop.
Sample Alexa Intent Handler written as a Python class.
class ReadTopFiveItems(AbstractRequestHandler):
"""Handler for ReadTopFive Intent."""
def can_handle(self, handler_input):
return ask_utils.is_intent_name("ReadTopFive")(handler_input)
def handle(self, handler_input):
logging.info("Called Skill Handler for ReadTopFive Intent.")
speak_output = "There are no new Azure items currently available for today."
ending = datetime.now()
starting = ending + timedelta(days=-7)
updatelist = get_updates_rss(startDate=starting,endDate=ending)
if len(updatelist) > 0:
speak_output = "Here are the most recent 5 Azure news items."
speak_output+= generate_list_respose(updatelist)
speak_output += " That's the most recent 5 announcements on Azure!"
return (
handler_input.response_builder
.speak(speak_output)
.ask(speak_output)
.response
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment