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

Side by Side Diff: dashboard/dashboard/services/gitiles_service.py

Issue 3013753002: [pinpoint] Increase Gitiles service timeout. (Closed)
Patch Set: Dashboard unit tests. Created 3 years, 3 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
« no previous file with comments | « no previous file | dashboard/dashboard/services/gitiles_service_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Functions for getting commit information from Gitiles.""" 5 """Functions for getting commit information from Gitiles."""
6 6
7 import base64 7 import base64
8 import json 8 import json
9 9
10 from google.appengine.api import urlfetch 10 from google.appengine.api import urlfetch
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 def _Request(url): 93 def _Request(url):
94 """Requests a URL with one retry.""" 94 """Requests a URL with one retry."""
95 try: 95 try:
96 return _RequestAndProcessHttpErrors(url) 96 return _RequestAndProcessHttpErrors(url)
97 except urlfetch.Error: # Maybe it's a transient error. Retry once. 97 except urlfetch.Error: # Maybe it's a transient error. Retry once.
98 return _RequestAndProcessHttpErrors(url) 98 return _RequestAndProcessHttpErrors(url)
99 99
100 100
101 def _RequestAndProcessHttpErrors(url): 101 def _RequestAndProcessHttpErrors(url):
102 """Requests a URL, converting HTTP errors to Python exceptions.""" 102 """Requests a URL, converting HTTP errors to Python exceptions."""
103 response = urlfetch.fetch(url) 103 response = urlfetch.fetch(url, deadline=10)
104 104
105 if response.status_code == 404: 105 if response.status_code == 404:
106 raise NotFoundError('Server returned HTTP code %d for %s' % 106 raise NotFoundError('Server returned HTTP code %d for %s' %
107 (response.status_code, url)) 107 (response.status_code, url))
108 elif response.status_code != 200: 108 elif response.status_code != 200:
109 raise urlfetch.Error('Server returned HTTP code %d for %s' % 109 raise urlfetch.Error('Server returned HTTP code %d for %s' %
110 (response.status_code, url)) 110 (response.status_code, url))
111 111
112 return response.content 112 return response.content
OLDNEW
« no previous file with comments | « no previous file | dashboard/dashboard/services/gitiles_service_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698