I know that there are many Jason Tutorials and Q & A here and on the Net, I have read; But I am still struggling to work my dragon script.
I'm calling the Python server program from the client to read the sample list. My error is:
& lt; Type 'exceptions.ValueError' & gt ;: A JSON object can not be decoded args = ('A JSON object can not be decoded'), message = 'No JSON object can be decoded' / Code> Somewhere in the server I got the wrong code, which is not taking the list and sending it as Jason String.
Everything is going on at a Mongos webserver.
Server (psptest5.py):
#! C: \ Mongoose \ Python26 \ python.exe import cgi import cgitb cgitb () import pyodbc import json import urlib2 import request url = "http: // localhost: 8080 /" value = {'customer': 'Varun Inc.' , 'Email': 'varun.verma@varun.com'} header = {'content-type': 'app / jason', 'accept': 'text / plain'} r = request. Post (URL, Data = JasonDendips (value), Header = Header) Customer (jsonreadtest.py):
#! C: \ Mongoose \ Python26 \ python.exe import cgi import cgitb cgitb.enable () import json import urllib2 import from pprint, print import csv, sys url = 'http: // localhost: 8080 / psptest5.py' data = json. Print Any help appreciated
Your server code does not provide anything Try the following code (server):
#! C: \ Mongoose \ Python26 \ python.exe Import Json Print 'Content-Type: App / Jason' Print Print json.dumps ({'Customer': 'Varun Ink', 'Email': 'varun.verma@varun.com '})
No comments:
Post a Comment