Content-Type must be application/json error with python 2.7.5 and couch DB 1.30 -


I'm running on Python 2.7.5 and couchDB 1.3.0 Win7 (64) and when I left a JSON document: Couchdb.http.ServerError: (415, (u'bad_content_type ', u'content-type must be application / json)). ...

  kkey = 'schluessel' vvalue = 'wert' str1 = [kkey, vvalue] str2 = json.dumps (str1) oup.write (str2 + '\ n') #   

Thanks for the help

div class = "post-text" itemprop = "text">

First of all JSON is trying to save the document, which is represented by the JSON object type, but the JSON array which is not a document at all. Try instead:

  kkey = 'schluessel' vvalue = 'wert' str1 = {kkey: vvalue} str2 = json.dumps (str1) oup.write (str2 + '\ n' ) # Lines given above: {"Schlusel": "wort"} doc_id, doc_rev = db.save (str2)    

Comments

Popular posts from this blog

python - Writing Greek in matplotlib labels, titles -

c# - LINQ to Entities does not recognize the method 'Int32 IndexOf(System.String, System.StringComparison)' method -

Pygame memory leak with transform.flip -