URL is http://*.*.*.*/100/?id=1&version=1
params is
{"cityId": "110000", "query": {"queryStr": "line1", "queryExp": ""}, "channelId": "house"}
curl command is:
curl -X POST -H "Content-Type: application/json" -d '{"cityId": "110000", "query": {"queryStr": "line1", "queryExp": ""}, "channelId": "house"}' "http://*.*.*.*/100/?id=1&version=1"
but when I use tornado(4.2) AsyncHTTPClient, I got error:
tornado.application:Future exception was never retrieved: Traceback (most recent call last):
...
HTTPError: HTTP 500: Internal Server Error
I request like this:
@gen.coroutine
def request(self, url, method="GET", headers=None, data=None):
logger.debug(method)
logger.debug(headers)
logger.debug(data)
headers = {
'content-type': 'application/json',
}
req = HTTPRequest(
url,
method=method,
headers=headers,
body=urllib.urlencode(data).encode('utf-8')
)
http_response = yield self.r.fetch(
# req,
# self.handle_request
url,
method=method,
headers=headers,
body=urllib.urlencode(data).encode('utf-8')
)
# logger.debug(http_response)
raise gen.Return(json.loads(http_response.body))
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)