I'm working with Django and Piston and I created the following Handler:
from piston.handler import BaseHandler
import datetime
import json
class NotificationHandler( BaseHandler ):
allowed_methods = ('POST',)
def create( self, request, token ):
return json.dumps( datetime.datetime.now() )
When making a request to this handler I'm getting an html page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>something</title>
<META name="description" content="something"><META name="keywords" content="something">
</head>
<frameset rows="100%,*" border="0">
<frame src="http://something.com/pay/notify/345345/" frameborder="0" />
<frame frameborder="0" noresize />
</frameset>
<!-- pageok -->
<!-- 03 -->
<!-- -->
</html>
It looks like it's wripping the call into a frameset. However I would expect to get something like:
"2012-01-11 00:17:24"
I'm using apache with mod_wsgi. When running the project locally from the server provided by the PyCharm IDE I get the expected json value.
Not sure why I'm getting different results since I'm using the same script to make the request (with the same headers).
What would make Piston return an HTML page instead of a raw json string? May it be a header?