| Index: upload.py
|
| diff --git a/upload.py b/upload.py
|
| index d85fea7427b3884706a08996cebace168b6d814b..7d611284707f877ab1928b58b7794b23344aa99f 100755
|
| --- a/upload.py
|
| +++ b/upload.py
|
| @@ -226,6 +226,35 @@ class AbstractRpcServer(object):
|
| return response_dict["Auth"]
|
| except urllib2.HTTPError, e:
|
| if e.code == 403:
|
| + # Try a temporary workaround.
|
| + if self.host.endswith(".google.com"):
|
| + account_type = "HOSTED"
|
| + req = self._CreateRequest(
|
| + url="https://www.google.com/accounts/ClientLogin",
|
| + data=urllib.urlencode({
|
| + "Email": email,
|
| + "Passwd": password,
|
| + "service": "ah",
|
| + "source": "rietveld-codereview-upload",
|
| + "accountType": account_type,
|
| + }),
|
| + )
|
| + try:
|
| + response = self.opener.open(req)
|
| + response_body = response.read()
|
| + response_dict = dict(x.split("=")
|
| + for x in response_body.split("\n") if x)
|
| + return response_dict["Auth"]
|
| + except urllib2.HTTPError, e:
|
| + if e.code == 403:
|
| + body = e.read()
|
| + response_dict = dict(x.split("=", 1) for x in body.split("\n")
|
| + if x)
|
| + raise ClientLoginError(req.get_full_url(), e.code, e.msg,
|
| + e.headers, response_dict)
|
| + else:
|
| + raise
|
| +
|
| body = e.read()
|
| response_dict = dict(x.split("=", 1) for x in body.split("\n") if x)
|
| raise ClientLoginError(req.get_full_url(), e.code, e.msg,
|
|
|