I am trying to make my Python program talk to a web service hosted on
app engine. I am using the appengine-rest-server and authentication
using a Google account is required on the server. The idea is that the
user specifies his username/password in the client application, and
then the client app. will talk to app engine server via webservices.
# read ClientLogin token (ugly)
line = f.readline()
token = ''
while line:
if line.startswith('Auth'):
token = line[5:]
line = g.readline()
# if we got token, login was completed
if token:
# URL to a Model called testmodel (via appengine-rest-server)
url = 'http://myappengineapp.appspot.com/rest/testmodel' # add Authorization header with token
headers = {'Authorization': 'GoogleLogin auth='+token}
handler = urllib2.HTTPHandler()
opener = urllib2.build_opener(handler)
req = urllib2.Request(url, headers=headers)
f = opener.open(req)
# Do something with response....
# close "files"
f.close()
g.close()
Correct? In fact, I am able to login, but somehow I can't use the
token to access the GAE app..
On Tue, Jul 14, 2009 at 8:03 PM, epb<esbenbu...@gmail.com> wrote:
> Hi,
> I am trying to make my Python program talk to a web service hosted on
> app engine. I am using the appengine-rest-server and authentication
> using a Google account is required on the server. The idea is that the
> user specifies his username/password in the client application, and
> then the client app. will talk to app engine server via webservices.
You may want to look at appengine_rpc.py, in the SDK
google.appengine.tools package. It is designed specifically for this.
> # read ClientLogin token (ugly)
> line = f.readline()
> token = ''
> while line:
> if line.startswith('Auth'):
> token = line[5:]
> line = g.readline()
The returned body is urlencoded, so you can use the built in
functionality for this.
> # if we got token, login was completed
> if token:
> # URL to a Model called testmodel (via appengine-rest-server)
> url = 'http://myappengineapp.appspot.com/rest/testmodel' > # add Authorization header with token
> headers = {'Authorization': 'GoogleLogin auth='+token}
> handler = urllib2.HTTPHandler()
> opener = urllib2.build_opener(handler)
> req = urllib2.Request(url, headers=headers)
> f = opener.open(req)
App Engine apps do not accept authorization headers - instead, you
need to make a request to a special URL with the token to get a user
cookie back. See appengine_rpc.py for details.
-Nick Johnson
> # Do something with response....
> # close "files"
> f.close()
> g.close()
> Correct? In fact, I am able to login, but somehow I can't use the
> token to access the GAE app..
-- Nick Johnson, App Engine Developer Programs Engineer
Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration
Number: 368047
I can see why Tony's version would work. His "algorithm" has two
steps:
1. Get the authorization token using ClientLogin (which I also managed
to do).
2. Use the uri "servername/_ah/login" to get the auth. cookie.
The appengine_rpc module seems to do authentication in a similar way:
A. Try to access the app. This results in a redirect to a location
that starts with https://www.google.com/accounts/ServiceLogin B. Get a auth. token (like step 1 above)
C. Use auth. token to get auth. cookie.
D. Try to access the app. again (this is where it fails in my case...)
Anyway, step C is performed using the function below:
-------
def _GetAuthCookie(self, auth_token):
"""Fetches authentication cookies for an authentication token.
Args:
auth_token: The authentication token returned by ClientLogin.
Raises:
HTTPError: If there was an error fetching the authentication
cookies.
"""
continue_location = "http://localhost/"
args = {"continue": continue_location, "auth": auth_token}
login_path = os.environ.get("APPCFG_LOGIN_PATH", "/_ah")
req = self._CreateRequest("%s://%s%s/login?%s" %
(self.scheme, self.host, login_path,
urllib.urlencode(args)))
try:
response = self.opener.open(req)
except urllib2.HTTPError, e:
response = e
if (response.code != 302 or
response.info()["location"] != continue_location):
raise urllib2.HTTPError(req.get_full_url(), response.code,
response.msg,
response.headers, response.fp)
self.authenticated = True
------
It seems to me, that we do nothing with the response in this
function?? Shouldn't we save the cookie in the response like Tony's
does above, and then use it when we try to log in again?
On Jul 15, 1:06 pm, epb <esbenbu...@gmail.com> wrote:
The response has the "Set-cookie" header set, which will cause the
user's browser to save the cookie and then present it on the next
request (after redirected by the 302). In my code I've opted not to
follow the redirect, and extracted the cookie myself, because it's the
urlfetch service doing the request, not the user. You can then either
return a response to the user with a "Set-cookie" HTTP header (causing
their browser to save the cookie), or handle it some other way (return
it in the body and set the cookie with Javascript, for example).
I think I misunderstood your original question, though, and you're
looking for something different. You want to get an authorization
cookie and then use it to make repeated requests with urlfetch, not
with a browser? If that's the case, you're going to want to capture
the "Set-cookie" header from the second response, and supply that in
future requests (setting the "Cookie" header for urlfetch).
Basically, urlfetch will follow redirects but it won't handle cookies
automatically - so what's happening is it's ignoring the "Set-cookie"
header and following the redirect, and being denied because it's not
supplying a cookie.
On Jul 15, 2:58 pm, epb <esbenbu...@gmail.com> wrote:
> I can see why Tony's version would work. His "algorithm" has two
> steps:
> 1. Get the authorization token using ClientLogin (which I also managed
> to do).
> 2. Use the uri "servername/_ah/login" to get the auth. cookie.
> The appengine_rpc module seems to do authentication in a similar way:
> A. Try to access the app. This results in a redirect to a location
> that starts withhttps://www.google.com/accounts/ServiceLogin > B. Get a auth. token (like step 1 above)
> C. Use auth. token to get auth. cookie.
> D. Try to access the app. again (this is where it fails in my case...)
> Anyway, step C is performed using the function below:
> -------
> def _GetAuthCookie(self, auth_token):
> """Fetches authentication cookies for an authentication token.
> Args:
> auth_token: The authentication token returned by ClientLogin.
> Raises:
> HTTPError: If there was an error fetching the authentication
> cookies.
> """
> continue_location = "http://localhost/"
> args = {"continue": continue_location, "auth": auth_token}
> login_path = os.environ.get("APPCFG_LOGIN_PATH", "/_ah")
> req = self._CreateRequest("%s://%s%s/login?%s" %
> (self.scheme, self.host, login_path,
> urllib.urlencode(args)))
> try:
> response = self.opener.open(req)
> except urllib2.HTTPError, e:
> response = e
> if (response.code != 302 or
> response.info()["location"] != continue_location):
> raise urllib2.HTTPError(req.get_full_url(), response.code,
> response.msg,
> response.headers, response.fp)
> self.authenticated = True
> ------
> It seems to me, that we do nothing with the response in this
> function?? Shouldn't we save the cookie in the response like Tony's
> does above, and then use it when we try to log in again?
> On Jul 15, 1:06 pm, epb <esbenbu...@gmail.com> wrote:
> > Thanks for your answers.
> > As I understand Nick's response, I only need to use appengine_rpc.py
> > for the entire process. I tried the following:
> > It seems to me that the Send() function should do all authentication-
> > work automatically and re-direct to the app page after logging in.
> > Right?
> > Anyway, I'll try out Tonys solution also..
> > On Jul 15, 11:18 am, Tony <fatd...@gmail.com> wrote:
> > > Since I happened to have this up, here's a bit of sample code to get
> > > an authentication cookie for an appspot app...
On Jul 15, 4:05 pm, Tony <fatd...@gmail.com> wrote:
> The response has the "Set-cookie" header set, which will cause the
> user's browser to save the cookie and then present it on the next
> request (after redirected by the 302). In my code I've opted not to
> follow the redirect, and extracted the cookie myself, because it's the
> urlfetch service doing the request, not the user. You can then either
> return a response to the user with a "Set-cookie" HTTP header (causing
> their browser to save the cookie), or handle it some other way (return
> it in the body and set the cookie with Javascript, for example).
> I think I misunderstood your original question, though, and you're
> looking for something different. You want to get an authorization
> cookie and then use it to make repeated requests with urlfetch, not
> with a browser? If that's the case, you're going to want to capture
> the "Set-cookie" header from the second response, and supply that in
> future requests (setting the "Cookie" header for urlfetch).
Yes, that is exactly what I want :) My client app. is not browser-
based. I guess I'll just use your method then.. appengine_rpc must be
intended for browser apps only, as it does nothing to capture the
auth. cookie. I could of course extend the appengine_rpc module to
capture the cookie, but the module uses urllib2.OpenerDirector.open()
to open URLs and this is perhaps not the way to go in my case? I am
not sure what the difference is between urlfetch() and open().... it
seems like I can get the headers (and hereby the cookie) by using info
() on the response from open().
> Basically, urlfetch will follow redirects but it won't handle cookies
> automatically - so what's happening is it's ignoring the "Set-cookie"
> header and following the redirect, and being denied because it's not
> supplying a cookie.
> On Jul 15, 2:58 pm, epb <esbenbu...@gmail.com> wrote:
> > I can see why Tony's version would work. His "algorithm" has two
> > steps:
> > 1. Get the authorization token using ClientLogin (which I also managed
> > to do).
> > 2. Use the uri "servername/_ah/login" to get the auth. cookie.
> > The appengine_rpc module seems to do authentication in a similar way:
> > A. Try to access the app. This results in a redirect to a location
> > that starts withhttps://www.google.com/accounts/ServiceLogin > > B. Get a auth. token (like step 1 above)
> > C. Use auth. token to get auth. cookie.
> > D. Try to access the app. again (this is where it fails in my case...)
> > Anyway, step C is performed using the function below:
> > -------
> > def _GetAuthCookie(self, auth_token):
> > """Fetches authentication cookies for an authentication token.
> > Args:
> > auth_token: The authentication token returned by ClientLogin.
> > It seems to me, that we do nothing with the response in this
> > function?? Shouldn't we save the cookie in the response like Tony's
> > does above, and then use it when we try to log in again?
> > On Jul 15, 1:06 pm, epb <esbenbu...@gmail.com> wrote:
> > > Thanks for your answers.
> > > As I understand Nick's response, I only need to use appengine_rpc.py
> > > for the entire process. I tried the following:
> > > It seems to me that the Send() function should do all authentication-
> > > work automatically and re-direct to the app page after logging in.
> > > Right?
> > > Anyway, I'll try out Tonys solution also..
> > > On Jul 15, 11:18 am, Tony <fatd...@gmail.com> wrote:
> > > > Since I happened to have this up, here's a bit of sample code to get
> > > > an authentication cookie for an appspot app...
I believe that the difference between urlfetch and urllib2 is
superficial - App Engine makes all requests using urlfetch, regardless
of which lib you use in your code.
On Jul 15, 4:55 pm, epb <esbenbu...@gmail.com> wrote:
> On Jul 15, 4:05 pm, Tony <fatd...@gmail.com> wrote:
> > The response has the "Set-cookie" header set, which will cause the
> > user's browser to save the cookie and then present it on the next
> > request (after redirected by the 302). In my code I've opted not to
> > follow the redirect, and extracted the cookie myself, because it's the
> > urlfetch service doing the request, not the user. You can then either
> > return a response to the user with a "Set-cookie" HTTP header (causing
> > their browser to save the cookie), or handle it some other way (return
> > it in the body and set the cookie with Javascript, for example).
> > I think I misunderstood your original question, though, and you're
> > looking for something different. You want to get an authorization
> > cookie and then use it to make repeated requests with urlfetch, not
> > with a browser? If that's the case, you're going to want to capture
> > the "Set-cookie" header from the second response, and supply that in
> > future requests (setting the "Cookie" header for urlfetch).
> Yes, that is exactly what I want :) My client app. is not browser-
> based. I guess I'll just use your method then.. appengine_rpc must be
> intended for browser apps only, as it does nothing to capture the
> auth. cookie. I could of course extend the appengine_rpc module to
> capture the cookie, but the module uses urllib2.OpenerDirector.open()
> to open URLs and this is perhaps not the way to go in my case? I am
> not sure what the difference is between urlfetch() and open().... it
> seems like I can get the headers (and hereby the cookie) by using info
> () on the response from open().
> > Basically, urlfetch will follow redirects but it won't handle cookies
> > automatically - so what's happening is it's ignoring the "Set-cookie"
> > header and following the redirect, and being denied because it's not
> > supplying a cookie.
> > On Jul 15, 2:58 pm, epb <esbenbu...@gmail.com> wrote:
> > > I can see why Tony's version would work. His "algorithm" has two
> > > steps:
> > > 1. Get the authorization token using ClientLogin (which I also managed
> > > to do).
> > > 2. Use the uri "servername/_ah/login" to get the auth. cookie.
> > > The appengine_rpc module seems to do authentication in a similar way:
> > > A. Try to access the app. This results in a redirect to a location
> > > that starts withhttps://www.google.com/accounts/ServiceLogin > > > B. Get a auth. token (like step 1 above)
> > > C. Use auth. token to get auth. cookie.
> > > D. Try to access the app. again (this is where it fails in my case...)
> > > Anyway, step C is performed using the function below:
> > > -------
> > > def _GetAuthCookie(self, auth_token):
> > > """Fetches authentication cookies for an authentication token.
> > > Args:
> > > auth_token: The authentication token returned by ClientLogin.
> > > It seems to me, that we do nothing with the response in this
> > > function?? Shouldn't we save the cookie in the response like Tony's
> > > does above, and then use it when we try to log in again?
> > > > It seems to me that the Send() function should do all authentication-
> > > > work automatically and re-direct to the app page after logging in.
> > > > Right?
On Wed, Jul 15, 2009 at 9:55 PM, epb<esbenbu...@gmail.com> wrote:
> On Jul 15, 4:05 pm, Tony <fatd...@gmail.com> wrote:
>> The response has the "Set-cookie" header set, which will cause the
>> user's browser to save the cookie and then present it on the next
>> request (after redirected by the 302). In my code I've opted not to
>> follow the redirect, and extracted the cookie myself, because it's the
>> urlfetch service doing the request, not the user. You can then either
>> return a response to the user with a "Set-cookie" HTTP header (causing
>> their browser to save the cookie), or handle it some other way (return
>> it in the body and set the cookie with Javascript, for example).
>> I think I misunderstood your original question, though, and you're
>> looking for something different. You want to get an authorization
>> cookie and then use it to make repeated requests with urlfetch, not
>> with a browser? If that's the case, you're going to want to capture
>> the "Set-cookie" header from the second response, and supply that in
>> future requests (setting the "Cookie" header for urlfetch).
> Yes, that is exactly what I want :) My client app. is not browser-
> based. I guess I'll just use your method then.. appengine_rpc must be
> intended for browser apps only, as it does nothing to capture the
> auth. cookie. I could of course extend the appengine_rpc module to
> capture the cookie, but the module uses urllib2.OpenerDirector.open()
> to open URLs and this is perhaps not the way to go in my case? I am
> not sure what the difference is between urlfetch() and open().... it
> seems like I can get the headers (and hereby the cookie) by using info
> () on the response from open().
appengine_rpc is intended for any Python app. It captures the cookie
by using a CookieJar, which does the capturing/sending of the cookie.
>> Basically, urlfetch will follow redirects but it won't handle cookies
>> automatically - so what's happening is it's ignoring the "Set-cookie"
>> header and following the redirect, and being denied because it's not
>> supplying a cookie.
>> On Jul 15, 2:58 pm, epb <esbenbu...@gmail.com> wrote:
>> > I can see why Tony's version would work. His "algorithm" has two
>> > steps:
>> > 1. Get the authorization token using ClientLogin (which I also managed
>> > to do).
>> > 2. Use the uri "servername/_ah/login" to get the auth. cookie.
>> > The appengine_rpc module seems to do authentication in a similar way:
>> > A. Try to access the app. This results in a redirect to a location
>> > that starts withhttps://www.google.com/accounts/ServiceLogin >> > B. Get a auth. token (like step 1 above)
>> > C. Use auth. token to get auth. cookie.
>> > D. Try to access the app. again (this is where it fails in my case...)
>> > Anyway, step C is performed using the function below:
>> > -------
>> > def _GetAuthCookie(self, auth_token):
>> > """Fetches authentication cookies for an authentication token.
>> > Args:
>> > auth_token: The authentication token returned by ClientLogin.
>> > It seems to me, that we do nothing with the response in this
>> > function?? Shouldn't we save the cookie in the response like Tony's
>> > does above, and then use it when we try to log in again?
>> > On Jul 15, 1:06 pm, epb <esbenbu...@gmail.com> wrote:
>> > > Thanks for your answers.
>> > > As I understand Nick's response, I only need to use appengine_rpc.py
>> > > for the entire process. I tried the following:
>> > > It seems to me that the Send() function should do all authentication-
>> > > work automatically and re-direct to the app page after logging in.
>> > > Right?
>> > > Anyway, I'll try out Tonys solution also..
>> > > On Jul 15, 11:18 am, Tony <fatd...@gmail.com> wrote:
>> > > > Since I happened to have this up, here's a bit of sample code to get
>> > > > an authentication cookie for an appspot app...
> On Wed, Jul 15, 2009 at 9:55 PM, epb<esbenbu...@gmail.com> wrote:
> > On Jul 15, 4:05 pm, Tony <fatd...@gmail.com> wrote:
> >> The response has the "Set-cookie" header set, which will cause the
> >> user's browser to save the cookie and then present it on the next
> >> request (after redirected by the 302). In my code I've opted not to
> >> follow the redirect, and extracted the cookie myself, because it's the
> >> urlfetch service doing the request, not the user. You can then either
> >> return a response to the user with a "Set-cookie" HTTP header (causing
> >> their browser to save the cookie), or handle it some other way (return
> >> it in the body and set the cookie with Javascript, for example).
> >> I think I misunderstood your original question, though, and you're
> >> looking for something different. You want to get an authorization
> >> cookie and then use it to make repeated requests with urlfetch, not
> >> with a browser? If that's the case, you're going to want to capture
> >> the "Set-cookie" header from the second response, and supply that in
> >> future requests (setting the "Cookie" header for urlfetch).
> > Yes, that is exactly what I want :) My client app. is not browser-
> > based. I guess I'll just use your method then.. appengine_rpc must be
> > intended for browser apps only, as it does nothing to capture the
> > auth. cookie. I could of course extend the appengine_rpc module to
> > capture the cookie, but the module uses urllib2.OpenerDirector.open()
> > to open URLs and this is perhaps not the way to go in my case? I am
> > not sure what the difference is between urlfetch() and open().... it
> > seems like I can get the headers (and hereby the cookie) by using info
> > () on the response from open().
> appengine_rpc is intended for any Python app. It captures the cookie
> by using a CookieJar, which does the capturing/sending of the cookie.
> -Nick Johnson
> >> Basically, urlfetch will follow redirects but it won't handle cookies
> >> automatically - so what's happening is it's ignoring the "Set-cookie"
> >> header and following the redirect, and being denied because it's not
> >> supplying a cookie.
> >> On Jul 15, 2:58 pm, epb <esbenbu...@gmail.com> wrote:
> >> > I can see why Tony's version would work. His "algorithm" has two
> >> > steps:
> >> > 1. Get the authorization token using ClientLogin (which I also managed
> >> > to do).
> >> > 2. Use the uri "servername/_ah/login" to get the auth. cookie.
> >> > The appengine_rpc module seems to do authentication in a similar way:
> >> > A. Try to access the app. This results in a redirect to a location
> >> > that starts withhttps://www.google.com/accounts/ServiceLogin > >> > B. Get a auth. token (like step 1 above)
> >> > C. Use auth. token to get auth. cookie.
> >> > D. Try to access the app. again (this is where it fails in my case...)
> >> > Anyway, step C is performed using the function below:
> >> > -------
> >> > def _GetAuthCookie(self, auth_token):
> >> > """Fetches authentication cookies for an authentication token.
> >> > Args:
> >> > auth_token: The authentication token returned by ClientLogin.
> >> > It seems to me, that we do nothing with the response in this
> >> > function?? Shouldn't we save the cookie in the response like Tony's
> >> > does above, and then use it when we try to log in again?
> >> > > It seems to me that the Send() function should do all authentication-
> >> > > work automatically and re-direct to the app page after logging in.
> >> > > Right?
Anyone who can help me on this? Like mentioned above I am able to save
the cookie using the appengine_rpc module, but the saved cookie is not
used properly as I am redirected again :(
I tried the custom version too, using Tony's code to get the cookie
and capture it in memory. But when I try to access the server with the
cookie in my CookieJar, the login-page is returned. My code:
As mentioned, a handle to the login-page is returned in the variable
'f'. If I print the cookiejar I can see the cookie, so it seems that
the cookie is fetched alright:
>>>print cookiejar
<cookielib.CookieJar[<Cookie ABCD=abcdefghijkl12345 for
myapp.appspot.com/accounts>]>
Do I need to send the cookie to the server in another way? Sorry about
all these questions, but I can't seem to find documentation on this..
On Jul 16, 11:22 am, epb <esbenbu...@gmail.com> wrote:
> Got http error, this is try #1
> Got 302 redirect. Location:https://www.google.com/accounts/ServiceLogin?service=ah&continue=http...
> Saving authentication cookies to ~/.appcfg_cookies
> Sending HTTP request:
> POST /? HTTP/1.1
> Host: myapp.appspot.com
> X-appcfg-api-version: 1
> Content-type: application/octet-stream
> Got http error, this is try #2
> -----
> Trying it again it now loads the cookies like it's supposed to, but I
> still get a redirect in the end (now to myapp.appspot.com??):
> -----
> Loaded authentication cookies from ~/.appcfg_cookies
> Server: myapp.appspot.com
> Sending HTTP request:
> POST /? HTTP/1.1
> Host: myapp.appspot.com
> X-appcfg-api-version: 1
> Content-type: application/octet-stream
> Got http error, this is try #1
> Got 302 redirect. Location:http://myapp.appspot.com/ > Sending HTTP request:
> POST /? HTTP/1.1
> Host: myapp.appspot.com
> X-appcfg-api-version: 1
> Content-type: application/octet-stream
> Got http error, this is try #2
> -----
> Please, let me know what I am doing wrong. Thanks in advance!
> On Jul 16, 9:23 am, "Nick Johnson (Google)" <nick.john...@google.com>
> wrote:
> > On Wed, Jul 15, 2009 at 9:55 PM, epb<esbenbu...@gmail.com> wrote:
> > > On Jul 15, 4:05 pm, Tony <fatd...@gmail.com> wrote:
> > >> The response has the "Set-cookie" header set, which will cause the
> > >> user's browser to save the cookie and then present it on the next
> > >> request (after redirected by the 302). In my code I've opted not to
> > >> follow the redirect, and extracted the cookie myself, because it's the
> > >> urlfetch service doing the request, not the user. You can then either
> > >> return a response to the user with a "Set-cookie" HTTP header (causing
> > >> their browser to save the cookie), or handle it some other way (return
> > >> it in the body and set the cookie with Javascript, for example).
> > >> I think I misunderstood your original question, though, and you're
> > >> looking for something different. You want to get an authorization
> > >> cookie and then use it to make repeated requests with urlfetch, not
> > >> with a browser? If that's the case, you're going to want to capture
> > >> the "Set-cookie" header from the second response, and supply that in
> > >> future requests (setting the "Cookie" header for urlfetch).
> > > Yes, that is exactly what I want :) My client app. is not browser-
> > > based. I guess I'll just use your method then.. appengine_rpc must be
> > > intended for browser apps only, as it does nothing to capture the
> > > auth. cookie. I could of course extend the appengine_rpc module to
> > > capture the cookie, but the module uses urllib2.OpenerDirector.open()
> > > to open URLs and this is perhaps not the way to go in my case? I am
> > > not sure what the difference is between urlfetch() and open().... it
> > > seems like I can get the headers (and hereby the cookie) by using info
> > > () on the response from open().
> > appengine_rpc is intended for any Python app. It captures the cookie
> > by using a CookieJar, which does the capturing/sending of the cookie.
> > -Nick Johnson
> > >> Basically, urlfetch will follow redirects but it won't handle cookies
> > >> automatically - so what's happening is it's ignoring the "Set-cookie"
> > >> header and following the redirect, and being denied because it's not
> > >> supplying a cookie.
> > >> > I can see why Tony's version would work. His "algorithm" has two
> > >> > steps:
> > >> > 1. Get the authorization token using ClientLogin (which I also managed
> > >> > to do).
> > >> > 2. Use the uri "servername/_ah/login" to get the auth. cookie.
> > >> > The appengine_rpc module seems to do authentication in a similar way:
> > >> > A. Try to access the app. This results in a redirect to a location
> > >> > that starts withhttps://www.google.com/accounts/ServiceLogin > > >> > B. Get a auth. token (like step 1 above)
> > >> > C. Use auth. token to get auth. cookie.
> > >> > D. Try to access the app. again (this is where it fails in my case...)
> > >> > Anyway, step C is performed using the function below:
> > >> > -------
> > >> > def _GetAuthCookie(self, auth_token):
> > >> > """Fetches authentication cookies for an authentication token.
> > >> > Args:
> > >> > auth_token: The authentication token returned by ClientLogin.
> > >> > It seems to me, that we do nothing with the response in this
> > >> > function?? Shouldn't we save the cookie in the response like Tony's
> > >> > does above, and then use it when we try to log in again?
> > >> > > It seems to me that the Send() function should do all authentication-
> > >> > > work automatically and re-direct to the app page after logging in.
> > >> > > Right?