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
This commit is contained in:
@@ -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:
|
||||
# {
|
||||
|
||||
Reference in New Issue
Block a user