title: Raspberry Pi Python passing json data to restful web service
body: <p>I am trying to pass data in json format from a python script in Raspberry Pi 2 to a web service. I have tried the following code:</p>
  
  <pre><code>import json 
  import requests
  import pprint
  url = 'http://192.168.1.101/TestWebsite/api/SecondlyReadingDatas'
  data = {'ID': '1', "ChannelID': '34','TimeStampID': '45}
  data_json=json.dumps(data)
  headers = {'Content-type': 'applcation/json'}
  response = requests.post(url, json=data)
  pprint.pprint(response.json))
  </code></pre>
  
  <p>However, I am getting the following error:</p>
  
  <blockquote>
    <p>{u'Message':u'An error has occured'}</p>
  </blockquote>
  
  <p>I have also tried changing the <code>response = requests.post(url, json=data)</code>to<code>response = requests.post(url, data=data_json, headers=headers)</code></p>
  
  <p>I referenced my python code from the following link:</p>
  
  <p><a href="https://stackoverflow.com/questions/13941742/rest-post-using-python-request">REST post using Python-Request</a></p>
  
  <p>I am however, still getting the same error message. I have no idea how to debug it since it does not display what kind of error. Would appreciate any help</p>