question

newuser-8aeb3f79-e874-4321-b35b-1323020dbfa9 avatar image

PLEASE PLEASE HELP WITH TIMER API

Hi All!

Could somone please look at this code:

timer = {

"duration": "PT15S",

"timerLabel": "Change name",

"creationBehavior": {

"displayExperience": {

"visibility": "VISIBLE"

}

},

"triggeringBehavior": {

"operation": {

"type": "ANNOUNCE",

"textToAnnounce": [

{

"locale": "en-US",

"text": "Break time"

}

]

},

"notificationConfig": {

"playAudible": True

}

}

}

class TimerHandler(AbstractRequestHandler):

def can_handle(self, handler_input):

return ask_utils.is_intent_name("TimerHandler")(handler_input)

def handle(self, handler_input):

request_envelope = handler_input.request_envelope

permissions = request_envelope.context.system.user

if not (permissions):

return (

handler_input.response_builder

.add_directive({

type: "Connections.SendRequest",

name: "AskFor",

payload: {

"@type": "AskForPermissionsConsentRequest",

"@version": "1",

"permissionScope": "alexa::alerts:timers:skill:readwrite"

},

token: "<string>"

})

.speak("This skill needs permission to access your timer")

.ask()

.response

)

else:

return requests.post("https://api.amazonalexa.com/v1/alerts/timers", timer), requests.status_codes


[ERROR] AttributeError: 'Response' object has no attribute 'deserialized_types'

Traceback (most recent call last):

File "/var/task/ask_sdk_core/skill_builder.py", line 112, in wrapper

return skill.serializer.serialize(response_envelope) # type:ignore

File "/var/task/ask_sdk_core/serialize.py", line 125, in serialize

return {key: self.serialize(val) for key, val in iteritems(obj_dict)}

File "/var/task/ask_sdk_core/serialize.py", line 125, in <dictcomp>

return {key: self.serialize(val) for key, val in iteritems(obj_dict)}

File "/var/task/ask_sdk_core/serialize.py", line 114, in serialize

k: k for k in obj.deserialized_types.keys()

alexa skills kitpython
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers