Question

Trying to set up remote_api stubs in my Python 2.7 AppEngine application, to use datastore access in conjunction with my localhost debugger (test my app using real data). Now, I've followed the tutorial on this AppEngine Remote API article and came up with this code (from a REST handler in our application):

from google.appengine.ext.remote_api import remote_api_stub
from model import MyExpandoObject

# This returns my credentials
def auth_func():
    return ("me@gmail.com", "mypassword")

# TODO This too
def get(w_self):
    # Connect remote api in identical way to example docs:
    remote_api_stub.ConfigureRemoteApi(None, '/_ah/remote_api', auth_func,'bsl-dm-hrd.appspot.com')

    # This calls the database (breakpoint here)
    t_entity = MyExpandoObject.get_by_key_name('akey')

Now, when I execute the code, the configuration of the stub passes. Then, when calling the database, I get this error in my debugger:

    BadRequestError: app s~myapp cannot access app dev~myapp's data

This, I believe, is the error I need to fix. Please do note that the s~ indicating this is an HRD application is properly reported as part of the app ID. I have also included the

builtins:
    - remote_api: on

directive in app.yaml.

My question is, why do I get this error? This is literally example code taken from the remote_api article. Just in case, I have also tried remote_api connection through remote_api_shell.py, bundled with the AppEngine SDK, and was able to connect to the datastore, import models and execute database calls. I am stumped as to why this fails.

Était-ce utile?

La solution

You have got mis-matching appids' You don't appear to be setting the appid - you have None as the first parameter to ConfigureRemoteApi you may need to set the --partition arg of the dev_server to have the appid you want, and or supply an appid to the ConfigureRemoteApi call

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top