title: json concatenate for request.post python
body: <p>I'm measuring temperature and humidity from a sensor.
  I want then to post the measures to a server as json strings.
  I'm using a python script.</p>
  
  <p>For optimisation, I want to group the json strings and post them.</p>
  
  <p>My code is like this:</p>
  
  <pre><code>current_time = time.localtime()[0:6]
  date = dateformat % current_time[0:6]
  temp = str(round(temp, 1))
  hum = str(round(hum, 1))
  
  lastest_measure = {'UID': uuid, 'date': date, 'temperature': temp, 'humidity': hum}
  r = requests.post(url, data=json.dumps(lastest_measure), headers=headers)
  print r
  
  &gt;&gt;&gt; response 200: Good !
  </code></pre>
  
  <p>But I can't concatenate the <code>lastest_measure</code> to a <code>grouped_measure</code>.</p>
  
  <p>I tried to concatenate with</p>
  
  <pre><code>grouped_measure = dict(group_measure.items() + lastest_measure.items())
  </code></pre>
  
  <p>but it gives me an error:  </p>
  
  <blockquote>
    <p>"AttributeError: 'dict' object has no attribute 'item'"</p>
  </blockquote>
  
  <p>I tried to create a string with all the measure (in the correct format, ie: <code>[{...},{...}, ...]</code>
  and then use the json.dumps</p>
  
  <pre><code>r = requests.post(url, data=json.dumps(grouped_measure), headers=headers)
  </code></pre>
  
  <p>But I get an error 500 (because the format doesn't inclue the '' between all the values)</p>
  
  <p>So my question is how can I concatenate 2 dictionaries in the right format for the <code>resquest.post</code> method ? (is it a method ???)</p>
  
  <p>Thanks in advance !
  Cheers,
  Mat</p>