1 # Copyright (c) 2014 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.
5 class HttpClient(object):
6 """Represent a http client for sending request to a http[s] server.
8 If cookies need to be sent, they should be in a file pointed to by
9 COOKIE_FILE in the environment.
13 def Get(url
, params
={}, timeout
=120, retries
=5, retry_interval
=0.5,
15 """Send a GET request to the given url with the given parameters.
18 url: the url to send request to.
19 params: parameters to send as part of the http request.
20 timeout: timeout for the http request, default is 120 seconds.
21 retries: indicate how many retries before failing, default is 5.
22 retry_interval: interval in second to wait before retry, default is 0.5.
23 retry_if_not: a http status code. If set, retry only when the failed http
24 status code is a different value.
28 state_code: the http status code in the response.
29 data: the body of the response.
31 raise NotImplemented()