我在google app-engine(http://spititan.appspot.com)上托管了一个应用程序.我还有一个命令行工具,可以通过ClientLogin访问该应用程序.代码段如下:
138 # get an AuthToken from Google accounts
139 auth_uri = 'https://www.google.com/accounts/ClientLogin'
140 authreq_data = urllib.parse.urlencode({ "Email": email_address,
141 "Passwd": password,
142 "service": "ah",
143 "source": appname,
144 "accountType": "HOSTED_OR_GOOGLE" })
145 request = urllib.request.Request(auth_uri, data=authreq_data)
146 response = opener.open(request)
147 response_body = str(response.read(), 'utf-8')
148 response_dict = dict(x.split("=") for x in response_body.split("\n") if x)
149 return response_dict["Auth"]
...
...
112 # Send the auth token to the AppEngine to login
113 continue_location = "http://localhost/"
114 args = …Run Code Online (Sandbox Code Playgroud)