سؤال

I've run into an issue trying to combine Apex and pyramid_rpc in a pyramid app. I'm running: pyramid 1.4, pyramid_rpc 0.5.1, apex 0.9.10dev on python 2.7.3

All my jsonrpc requests were returning 32600 errors. To enable pyramid_rpc in my _init I have:

config.include('pyramid_rpc.jsonrpc')

I knew my rpc calls and services were good so I searched high and low, simplifying everything. The culprit turned out to be a single line:

config.include("apex")

Without apex enabled my rpc calls run fine.

Saintly Pyramid Gurus, any ideas why this might be the case?

هل كانت مفيدة؟

المحلول

Your issue is that apex requires csrf tokens on every post request. You need to exclude your JSON-RPC endpoints from this requirement by setting the apex.no_csrf ini setting appropriately. In my dummy application I have config.add_jsonrpc_endpoint('foo', '/foo/jsonrpc'). It was returning -32600 until I set apex.no_csrf = apex:callback,foo. Note that there is no space between the comma-delimited options.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top