Accessing an App Engine app from the command line using OAuth2?

I have an App Engine site with a url marked login:required

in app.yaml. I need to access this url from a command line script. How do I do this now that OAuth2 has replaced ClientLogin?

The previous questions () all ended with ClientLogin which was removed:

OAuth2 is a drop-in replacement, but when I try to use that my script is constantly being redirected to the login page.

Can anyone see what I am doing wrong?

from google.appengine.tools import appengine_rpc_httplib2

authParams = appengine_rpc_httplib2.HttpRpcServerOAuth2.OAuth2Parameters(
  access_token=None,
  # id & secret come from http://console.developers.google.com
  client_id="FIXME",
  client_secret="FIXME",
  # I'm not sure this is the right scope
  scope="https://www.googleapis.com/auth/appengine.admin",
  refresh_token=None,
  credential_file=None
)
rpcServer = appengine_rpc_httplib2.HttpRpcServerOAuth2('example.appspot.com',
                                                       authParams,
                                                       None,
                                                       'ignored',
                                                       save_cookies=False,
                                                       auth_tries=3)
# Makes the actual GET request
result = rpcServer.Send('/some_url/', payload=None)
print result

      

(I am using python, but I would be open to any way of doing this from the command line, even curl.)

+3


source to share





All Articles