Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: third_party/upload.py

Issue 6340006: Revert http://codereview.chromium.org/6345001/ because it apparently... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2007 Google Inc. 3 # Copyright 2007 Google Inc.
4 # 4 #
5 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License. 6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at 7 # You may obtain a copy of the License at
8 # 8 #
9 # http://www.apache.org/licenses/LICENSE-2.0 9 # http://www.apache.org/licenses/LICENSE-2.0
10 # 10 #
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 req = self._CreateRequest(url=url, data=payload) 395 req = self._CreateRequest(url=url, data=payload)
396 req.add_header("Content-Type", content_type) 396 req.add_header("Content-Type", content_type)
397 if extra_headers: 397 if extra_headers:
398 for header, value in extra_headers.items(): 398 for header, value in extra_headers.items():
399 req.add_header(header, value) 399 req.add_header(header, value)
400 try: 400 try:
401 f = self.opener.open(req) 401 f = self.opener.open(req)
402 response = f.read() 402 response = f.read()
403 f.close() 403 f.close()
404 return response 404 return response
405 except urllib2.URLError, e:
406 reason = e.reason
407 if isinstance(reason, str) and reason.find("110") != -1:
408 # Connection timeout error.
409 if tries <= 3:
410 # Try again.
411 continue
412 raise
413 except urllib2.HTTPError, e: 405 except urllib2.HTTPError, e:
414 if tries > 3: 406 if tries > 3:
415 raise 407 raise
416 elif e.code == 401 or e.code == 302: 408 elif e.code == 401 or e.code == 302:
417 url_loc = urlparse.urlparse(url) 409 url_loc = urlparse.urlparse(url)
418 self._Authenticate('%s://%s' % (url_loc[0], url_loc[1])) 410 self._Authenticate('%s://%s' % (url_loc[0], url_loc[1]))
419 ## elif e.code >= 500 and e.code < 600: 411 ## elif e.code >= 500 and e.code < 600:
420 ## # Server Error - try again. 412 ## # Server Error - try again.
421 ## continue 413 ## continue
422 elif e.code == 301: 414 elif e.code == 301:
(...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 try: 1777 try:
1786 RealMain(sys.argv) 1778 RealMain(sys.argv)
1787 except KeyboardInterrupt: 1779 except KeyboardInterrupt:
1788 print 1780 print
1789 StatusUpdate("Interrupted.") 1781 StatusUpdate("Interrupted.")
1790 sys.exit(1) 1782 sys.exit(1)
1791 1783
1792 1784
1793 if __name__ == "__main__": 1785 if __name__ == "__main__":
1794 main() 1786 main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698