python - How to send request to url that is set to 'login:admin' in google app engine? -
in app.yaml, url defined be:
- url: /api/.* script: main.app login: admin secure:
i tried following code talk api
import requests def main(): r = requests.get("https://test.appspots.com/api/get_data", auth=('me@me.com', 'password')) print r.status_code, r.text if __name__ == '__main__': main()
but authentication has failed and, judging output, redirect login page.
how can use python authenticate , access url?
login: admin
instructs google app engine restrict urls matching given pattern users authenticated google and administrators of google app engine project. there no way use standard http basic authentication restriction. if have valid oauth bearer token can pass in header in requests.get
handle required authentication.
see article on appidentity possible options: https://cloud.google.com/appengine/docs/python/appidentity/
Comments
Post a Comment