How do I make an authenticated request from a python script to appengine? I have found lots of different methods on the web but none work. E.G. How do you access an authenticated Google App Engine service from a (non-web) python client? doesn't work, the request returns the login page. That post is old, maybe something changed since then. Has anyone got a nice wrapped object to do this?
Asked
Active
Viewed 378 times
4
-
You should post your answer as an answer, then accept it. – Nick Johnson Apr 13 '12 at 05:11
2 Answers
1
Answered my own question:
from google.appengine.tools import appengine_rpc
use_production = True
if use_production:
base_url = 'myapp.appspot.com'
else:
base_url = 'localhost:8080'
def passwdFunc():
return ('user@gmail.com','password')
def main(argv):
rpcServer = appengine_rpc.HttpRpcServer(base_url,
passwdFunc,
None,
'myapp',
save_cookies=True,
secure=use_production)
# Makes the actual call, I guess is the same for POST and GET?
blah = rpcServer.Send('/some_path/')
print blah
if __name__ == '__main__':
main(sys.argv)

user683264
- 83
- 5
-
Is this the only way? can't you just authenticate by making a request to the login url? – fccoelho May 03 '14 at 20:35
-
1This no longer works, as appengine_rpc uses ClientLogin, which has been deprecated and removed (see https://developers.google.com/identity/protocols/AuthForInstalledApps) – Mark Ivey Jun 26 '15 at 02:48
0
You can see one example of a non-web authenticated python client making requests in the Python client library used to process GAE Pull Queues at https://developers.google.com/appengine/docs/python/taskqueue/overview-pull#Using_the_Task_Queue_REST_API_with_the_Python_Google_API_Library

Carter Maslan
- 493
- 4
- 11