Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 43439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T15:29:44+00:00 2026-05-10T15:29:44+00:00

I have a Google App Engine app – http://mylovelyapp.appspot.com/ It has a page –

  • 0

I have a Google App Engine app – http://mylovelyapp.appspot.com/ It has a page – mylovelypage

For the moment, the page just does self.response.out.write('OK')

If I run the following Python at my computer:

import urllib2 f = urllib2.urlopen('http://mylovelyapp.appspot.com/mylovelypage') s = f.read() print s f.close() 

it prints ‘OK’

the problem is if I add login:required to this page in the app’s yaml

then this prints out the HTML of the Google Accounts login page

I’ve tried ‘normal’ authentication approaches. e.g.

passman = urllib2.HTTPPasswordMgrWithDefaultRealm()  auth_handler = urllib2.HTTPBasicAuthHandler() auth_handler.add_password(None,                           uri='http://mylovelyapp.appspot.com/mylovelypage',                           user='billy.bob@gmail.com',                           passwd='billybobspasswd') opener = urllib2.build_opener(auth_handler) urllib2.install_opener(opener) 

But it makes no difference – I still get the login page’s HTML back.

I’ve tried Google’s ClientLogin auth API, but I can’t get it to work.

h = httplib2.Http()  auth_uri = 'https://www.google.com/accounts/ClientLogin' headers = {'Content-Type': 'application/x-www-form-urlencoded'} myrequest = 'Email=%s&Passwd=%s&service=ah&source=DALELANE-0.0' % ('billy.bob@gmail.com', 'billybobspassword') response, content = h.request(auth_uri, 'POST', body=myrequest, headers=headers)  if response['status'] == '200':     authtok = re.search('Auth=(\S*)', content).group(1)      headers = {}     headers['Authorization'] = 'GoogleLogin auth=%s' % authtok.strip()     headers['Content-Length'] = '0'      response, content = h.request('http://mylovelyapp.appspot.com/mylovelypage',                                    'POST',                                    body='',                                    headers=headers)      while response['status'] == '302':                 response, content = h.request(response['location'], 'POST', body='', headers=headers)       print content 

I do seem to be able to get some token correctly, but attempts to use it in the header when I call ‘mylovelypage’ still just return me the login page’s HTML. 🙁

Can anyone help, please?

Could I use the GData client library to do this sort of thing? From what I’ve read, I think it should be able to access App Engine apps, but I haven’t been any more successful at getting the authentication working for App Engine stuff there either

Any pointers to samples, articles, or even just keywords I should be searching for to get me started, would be very much appreciated.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T15:29:44+00:00Added an answer on May 10, 2026 at 3:29 pm

    appcfg.py, the tool that uploads data to App Engine has to do exactly this to authenticate itself with the App Engine server. The relevant functionality is abstracted into appengine_rpc.py. In a nutshell, the solution is:

    1. Use the Google ClientLogin API to obtain an authentication token. appengine_rpc.py does this in _GetAuthToken
    2. Send the auth token to a special URL on your App Engine app. That page then returns a cookie and a 302 redirect. Ignore the redirect and store the cookie. appcfg.py does this in _GetAuthCookie
    3. Use the returned cookie in all future requests.

    You may also want to look at _Authenticate, to see how appcfg handles the various return codes from ClientLogin, and _GetOpener, to see how appcfg creates a urllib2 OpenerDirector that doesn’t follow HTTP redirects. Or you could, in fact, just use the AbstractRpcServer and HttpRpcServer classes wholesale, since they do pretty much everything you need.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 65k
  • Answers 65k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer You are having this problem because the method you are… May 11, 2026 at 11:02 am
  • added an answer I have a similar situation, and I solved it slightly… May 11, 2026 at 11:02 am
  • added an answer I found a file in the Office 2003 toolkit, Office… May 11, 2026 at 11:02 am

Related Questions

I have a Google App Engine app - http://mylovelyapp.appspot.com/ It has a page -
I have a simple Google App Engine app, that I wrote using ordinary strings.
So I have this code in a google app engine template: <select name='voter'> {%
I'm using Google App Engine and Django templates. I have a table that I
I have a Google Map that suddenly stopped working for no apparent reason (I
I have a page with a Google Maps mashup that has pushpins that are
I have a <div> that holds a google ad. My website is mostly AJAX
I have a (Wordpress powered) website, and Google is indexing some of the sub-directories.
I have a simple object that get's geocoding data from the Google Maps API
Say I have a web service http://www.example.com/webservice.pl?q=google which returns text google.com. I need to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.