From 0227eca3bb916becb5318fc6856673e38fc526c1 Mon Sep 17 00:00:00 2001 From: Gregory Szorc Date: Tue, 16 Feb 2016 12:18:51 -0800 Subject: [PATCH] Bug 1245953 - Use requests for performing HTTP request; r=garndt requests should *always* be used for performing HTTP requests because it has a better API *and* has sane security defaults compared to the HTTP request APIs in the Python standard library. Although, Python 2.7.9+ does have slightly saner defaults in the standard library. I still trust requests more. MozReview-Commit-ID: GqohpfYYGBw --HG-- extra : rebase_source : e6850a80818d73205a22ea4ba92be9e0ec43a473 --- testing/taskcluster/mach_commands.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/taskcluster/mach_commands.py b/testing/taskcluster/mach_commands.py index 8de38c83e5ce..f462126e56d0 100644 --- a/testing/taskcluster/mach_commands.py +++ b/testing/taskcluster/mach_commands.py @@ -152,10 +152,10 @@ def query_vcs_info(repository, revision): PushInfo = namedtuple('PushInfo', ['pushid', 'pushdate']) try: - import urllib2 + import requests url = '%s/json-pushes?changeset=%s' % (repository, revision) sys.stderr.write("Querying URL for pushdate: %s\n" % url) - contents = json.load(urllib2.urlopen(url)) + contents = requests.get(url).json() # The contents should be something like: # {