How to send request to url that is set to 'login:admin' in google app engine?
Question: In my app.yaml, a url is defined to be:

    
    
    - url: /api/.*
      script: main.app
      login: admin
      secure: always
    

I tried to the following code to talk to the 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 from the output, I am redirect to a
login page.

How can I use python to authenticate and access the url?


Answer: `login: admin` instructs Google App Engine to restrict URLs matching the given
pattern to users who are authenticated with Google _AND_ are Administrators of
your Google App Engine project. There is no way to use standard HTTP Basic
Authentication with this restriction. If you have a valid oAuth Bearer token
you can pass it in the header in `requests.get` to handle the required
authentication.

See this article on appidentity for some possible options:
<https://cloud.google.com/appengine/docs/python/appidentity/>

