OLD | NEW |
---|---|
(Empty) | |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 from google.appengine.api import urlfetch | |
6 | |
7 class FetchException(Exception): | |
8 """Thrown when status code is not 200. | |
9 """ | |
10 def __init__(self, url): | |
11 Exception.__init__(self, 'Fetch exception from ' + url) | |
12 | |
13 def Fetch(url): | |
14 result = urlfetch.fetch( | |
15 url="http://omahaproxy.appspot.com/json", | |
Aaron Boodman
2012/05/22 22:45:02
I don't think this or the stuff in google/appengin
cduvall
2012/05/24 00:15:40
Much better, good idea.
| |
16 method=urlfetch.GET) | |
17 | |
18 if result.status_code != 200: | |
19 raise FetchException(url) | |
20 return result.content | |
OLD | NEW |