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
This commit is contained in:
Gregory Szorc 2016-02-16 12:18:51 -08:00
Родитель 390db245b5
Коммит 0227eca3bb
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -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:
# {