import urllib.request, urllib.error, urllib.parse
import simplejson as json
opener = urllib.request.build_opener()
req = urllib.request.Request('http://localhost:8000', data=json.dumps({'a': 'b'}),
    headers={'Content-Type': 'application/json'})
response = opener.open(req)
Not possible to set content-type to application/json using urllib2