Closed AtheMathmo closed 8 years ago
I think the idea is for you to modify the request.session variables (deleting and adding to it) without needing to return the same variables over and over.
So you can do:
def some_handler(request):
request.session['new_attr'] = 'foobar'
return alexa.create_response('something')
And the new attribute will automatically get propagated down into the request. instead of
def some_handler(request):
session = request.session
session['new_attr'] = 'foobar'
return alexa.create_response('something', session_attributes=session)
Do you think this way of doing things is too difficult to understand or removes some functionality? If so we could consider revert to the old style of doing things - but I am guessing most people who are working with session attributes might appreciate the abstraction.
Ah yeah - you're right. Sorry this was towards the end of a day at Angel Hack and I didn't see the functionality you've described above.
I think it is a little difficult to understand but perhaps some documentation is a better way to solve that. I think the functionality itself is better as is.
P.S. We won the Amazon Alexa prize with the help of your library, thanks!
Yup, more documentation definitely seems necessary! I'll add it to the lambda_handler.py module, and keep this issue open until then.
Great to hear that you guys won! What did you build? Is it possible to get a link to a demo or something? Hopefully this repo allowed you to focus on your functionality instead of basic plumbing for Alexa!
We do have a demo video! I sent it to your email.
This library definitely helped us focus on functionality. It took a little while to understand how everything fits together (though you were a big help with that). Thanks again for your hard work with this :)
The end of the
alexa_io.route_request
reads as follows:The
request
variable is the incoming request from Alexa which will always haveNone
attributes unless we explicitly store some. This means that the code above removes any attributes we assign before returning the response.I think the correct behaviour would be to simply remove the line that reassigns the attributes? This would allow the user to specify any
sessionAttributes
in their responses. To allow for this we modified thecreate_response
method as so:Of course - it is likely I'm misunderstanding the intended usage! I'm happy to file a PR if you do want the above changes.