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 7890493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:22:07+00:00 2026-06-03T06:22:07+00:00

Log in Google Appengine with Python and urllib2 I have got Auth and Sid

  • 0

Log in Google Appengine with Python and urllib2
I have got Auth and Sid from https://www.google.com/accounts/ClientLogin
But then I added header,only to see that I was not loggin in.

Here is my code(I’m a new python user,the code will be very bad..):

LOGIN_URL = 'https://www.google.com/accounts/ClientLogin'
EMAIL = 'XXXXX@gmail.com'
PASSWORD = 'XXXXX'
print "Your Google account:"
print EMAIL
print "Logging in..."
arequest = urllib2.Request(LOGIN_URL, urlencode({
    'service': 'ah',
    'Email': EMAIL,
    'Passwd': PASSWORD,
}))

f = urllib2.urlopen(arequest)
lines = f.read().split()
auth = lines[2][5:]
sid = lines[0][4:]
print "Google Logged in"
#print auth and sid,and you will find the code above is right
brequest = urllib2.Request("https://appengine.google.com")
brequest.add_header('User-Agent', 'Here is Chrome's UA')
brequest.add_header('Content-Type', 'application/x-www-form-urlencoded')
brequest.add_header('Authorization', 'GoogleLogin auth=' + auth)
brequest.add_header('Cookie', 'SID=' + sid)
brequest.add_header('Referer', 'https://appengine.google.com/start') 
print "Opening with Auth info..."
bresponse = urllib2.urlopen(brequest)
print bresponse.read()
#The output shows that I haven't logged in.

I used firebug in firefox to view the header info,the cookie was not only the sid above.
What should I do?The performance next needs logged in(I haven’t write that),how should I write?
It was lunched on my laptop,so I don’t use appengieg’s lib like urlfetch.
Very appreciated!

  • 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. Editorial Team
    Editorial Team
    2026-06-03T06:22:08+00:00Added an answer on June 3, 2026 at 6:22 am

    i think the SID isn’t the only cookie you need to send, and the Authorization header shouldn’t be sent her.

    you should use a CookieJar with a HttpCookieProcessor to manage your cookies instead of doing it manually. example here

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

Sidebar

Related Questions

http://code.google.com/intl/en/appengine/docs/python/tools/uploadingdata.html the api is : Downloading Data from App Engine To start a data
from google.appengine.ext import db class Log(db.Model): content = db.StringProperty(multiline=True) class MyThread(threading.Thread): def run(self,request): #logs_query
I'm using Appstats as documented here: http://code.google.com/appengine/docs/python/tools/appstats.html It works fine, but every request now
I'm trying to fetch data of some https website from google appengine (java). There
I'm having trouble using python function decorators in Google's AppEngine. I'm not that familiar
I have a Python App Engine application where a user can log in using
GAE not works with: import com.google.appengine.repackaged.com.google.common.base.Hash; import com.google.appengine.repackaged.com.google.common.io.ByteStreams; and my code: byte[] inputBytes; try
I have built a web app in Python for Google App Engine. It is
I get many normal log lines in my google app engine application. But today
in google's bigtable context, what does a commit log mean? and what is the

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.