I have an App Engine site with a URL which is marked login:required
in app.yaml. I need to access this URL from a command-line script. How do I do that now that OAuth2 has replaced ClientLogin?
Previous questions () all end up using ClientLogin, which has been removed:
- How do you access an authenticated Google App Engine service from a (non-web) python client?
- How to make an authenticated request from a script to appengine?
- How do I use OAuth2 in a command line tool to access an application hosted on Google Appengine?
OAuth2 is the replacement, but when I try to use that, my script continually gets redirected to the login page.
Can anyone see what I'm 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'm using python but I'd be open to any way to do this from the command-line, even curl.)