I'm trying to get bottle to receive json in an xmlhttprequest and I'm getting a 405 error
Part of my bottle script:
@app.route('/myroute/')
def myroute():
print request.json
Part of my other script to test the xhr out:
jdata = json.dumps({"foo":"bar"})
urllib2.urlopen("http://location/app/myroute/", jdata)
Why am I getting a 405?
bottlepy error: 127.0.0.1 - - [2012-09-23 23:09:34] "POST /myroute/ HTTP/1.0" 405 911 0.005458
urllib2 error: urllib2.HTTPError: HTTP Error 405: Method Not Allowed
I also tried variations of:
@app.route('/myroute/json:json#[1-9]+#')
def myroute(json):
request.content_type = 'application/json'
print request.json, json
Returning json does not seem to be an issue