title: Adding session attributes in Python for Alexa skills
body: <p>I have 3 slots (<code>account</code>, <code>dollar_value</code>, <code>recipient_first</code>) within my intent schema for an Alexa skill and I want to save whatever slots are provided by the speaker in the session Attributes.</p>
  
  <p>I am using the following methods to set session attributes:</p>
  
  <pre><code>def create_dollar_value_attribute(dollar_value):
      return {"dollar_value": dollar_value}
  
  def create_account_attribute(account):
      return {"account": account}
  
  def create_recipient_first_attribute(recipient_first):
      return {"recipient_first": recipient_first}
  </code></pre>
  
  <p>However, as you may guess, if I want to save more than one slot as data in <code>sessionAttributes</code>, the <code>sessionAttributes</code> is overwritten as in the following case:</p>
  
  <pre><code>session_attributes = {}
  if session.get('attributes', {}) and "recipient_first" not in session.get('attributes', {}):
          recipient_first = intent['slots']['recipient_first']['value']
          session_attributes = create_recipient_first_attribute(recipient_first)
  
  
  if session.get('attributes', {}) and "dollar_value" not in session.get('attributes', {}):
          dollar_value = intent['slots']['dollar_value']['value']
          session_attributes = create_dollar_value_attribute(dollar_value)
  </code></pre>
  
  <p>The JSON response from my lambda function for a speech input in which two slots (<code>dollar_value</code> and <code>recipient_first</code>) were provided is as follows (my guess is that <code>the create_dollar_value_attribute</code> method in the second if statement is overwriting the first):</p>
  
  <pre><code>{
    "version": "1.0",
    "response": {
      "outputSpeech": {
        "type": "PlainText",
        "text": "Some text output"
      },
      "card": {
        "content": "SessionSpeechlet - Some text output",
        "title": "SessionSpeechlet - Send Money",
        "type": "Simple"
      },
      "reprompt": {
        "outputSpeech": {
          "type": "PlainText"
        }
      },
      "shouldEndSession": false
    },
    "sessionAttributes": {
      "dollar_value": "30"
    }
  }
  </code></pre>
  
  <p>The correct response for <code>sessionAttributes</code> should be:</p>
  
  <pre><code>"sessionAttributes": {
      "dollar_value": "30",
      "recipient_first": "Some Name"
    },
  </code></pre>
  
  <p>How do I create this response? Is there a better way to add values to <code>sessionAttributes</code> in the JSON response?</p>