diff options
author | stgao@chromium.org <stgao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-16 00:32:03 +0000 |
---|---|---|
committer | stgao@chromium.org <stgao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-16 00:33:03 +0000 |
commit | 968259ac6c1514fe9b0f295f6fad7185e6ca9ebc (patch) | |
tree | 0b2a01065e1000fdb1070e3ebb52c5f91ed742fd /tools/findit/common/utils.py | |
parent | 345949391e63d5237326eb16771ae48af0a2e881 (diff) | |
download | chromium_src-968259ac6c1514fe9b0f295f6fad7185e6ca9ebc.zip chromium_src-968259ac6c1514fe9b0f295f6fad7185e6ca9ebc.tar.gz chromium_src-968259ac6c1514fe9b0f295f6fad7185e6ca9ebc.tar.bz2 |
[Findit] Support sending cookies for http requests.
BUG=
R=aarya@google.com, mbarbella@chromium.org
Review URL: https://codereview.chromium.org/465403004
Cr-Commit-Position: refs/heads/master@{#290064}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290064 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/findit/common/utils.py')
-rw-r--r-- | tools/findit/common/utils.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/findit/common/utils.py b/tools/findit/common/utils.py new file mode 100644 index 0000000..363048c --- /dev/null +++ b/tools/findit/common/utils.py @@ -0,0 +1,31 @@ +# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import re +import sys + +from http_client_local import HttpClientLocal + + +GIT_HASH_PATTERN = re.compile(r'^[0-9a-fA-F]{40}$') + + +def GetOSName(platform_name=sys.platform): + if platform_name == 'cygwin' or platform_name.startswith('win'): + return 'win' + elif platform_name.startswith('linux'): + return 'unix' + elif platform_name.startswith('darwin'): + return 'mac' + else: + return platform_name + + +def IsGitHash(revision): + return GIT_HASH_PATTERN.match(str(revision)) + + +def GetHttpClient(): + # TODO(stgao): return implementation for appengine when running on appengine. + return HttpClientLocal |