I am using python+webapp2 for my backend code. The POST method looks like::
class SendOTP(BookSearchRequestHandler):
def post(self):
phone_no = self.request.get('phno').rstrip()
uuid = self.request.get('uuid').rstrip()
//some operations
//construction of JSON
tpl_values = {
'books': book1_list,
'query': search_query,
'is_logged':is_logged,
'is_ipsame':is_ipsame
}
self.render('serp/products.html', **tpl_values)
This works very well with my front-end html code. I can POST values and then render another page with contents of tpl_values.
However, now I am developing android app. The android app expects to send and receive data in JSON format. The code self.request.get() cannot read the values sent by POSTMAN POST. I get 405 method not allowed, The method GET Not Allowed. Also self.render cannot be used to send data to android.
<html>
<head>
<title>405 Method Not Allowed</title>
</head>
<body>
<h1>405 Method Not Allowed</h1>
The method GET is not allowed for this resource.
<br />
<br />
</body>
</html>
How can I modify the code so that it serves requests from both html and android , POSTMAN? Thanks