From 5d824b59c2fd037096e1f8a5a7675231b5524801 Mon Sep 17 00:00:00 2001
From: Henrik Levkowetz <henrik@levkowetz.com>
Date: Mon, 2 Mar 2020 15:18:00 +0000
Subject: [PATCH] Changed some cases of urlopen() to use requests.get()  -
 Legacy-Id: 17374

---
 ietf/bin/iana-protocols-updates   | 2 +-
 ietf/bin/rfc-editor-index-updates | 7 ++-----
 ietf/bin/rfc-editor-queue-updates | 3 +--
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/ietf/bin/iana-protocols-updates b/ietf/bin/iana-protocols-updates
index ab1caed81..055a80c43 100755
--- a/ietf/bin/iana-protocols-updates
+++ b/ietf/bin/iana-protocols-updates
@@ -30,7 +30,7 @@ syslog.syslog("Updating history log with new RFC entries from IANA protocols pag
 # FIXME: this needs to be the date where this tool is first deployed
 rfc_must_published_later_than = datetime.datetime(2012, 11, 26, 0, 0, 0)
 
-text = fetch_protocol_page(settings.IANA_SYNC_PROTOCOLS_URL)
+text = requests.get(settings.IANA_SYNC_PROTOCOLS_URL).text
 rfc_numbers = parse_protocol_page(text)
 for chunk in chunks(rfc_numbers, 100):
     updated = update_rfc_log_from_protocol_page(chunk, rfc_must_published_later_than)
diff --git a/ietf/bin/rfc-editor-index-updates b/ietf/bin/rfc-editor-index-updates
index e9ac43a6c..987760696 100755
--- a/ietf/bin/rfc-editor-index-updates
+++ b/ietf/bin/rfc-editor-index-updates
@@ -11,8 +11,6 @@ import sys
 import syslog
 import traceback
 
-from six.moves.urllib.request import urlopen
-
 # boilerplate
 basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
 sys.path = [ basedir ] + sys.path
@@ -49,11 +47,10 @@ log("Updating document metadata from RFC index from %s" % settings.RFC_EDITOR_IN
 
 
 socket.setdefaulttimeout(30)
-rfc_index_xml = urlopen(settings.RFC_EDITOR_INDEX_URL)
+rfc_index_xml = requests.get(settings.RFC_EDITOR_INDEX_URL).text
 index_data = ietf.sync.rfceditor.parse_index(rfc_index_xml)
 
-rfc_errata_json = urlopen(settings.RFC_EDITOR_ERRATA_JSON_URL)
-errata_data = json.load(rfc_errata_json)
+errata_data = requests.get(settings.RFC_EDITOR_ERRATA_JSON_URL).json()
 
 if len(index_data) < ietf.sync.rfceditor.MIN_INDEX_RESULTS:
     log("Not enough index entries, only %s" % len(index_data))
diff --git a/ietf/bin/rfc-editor-queue-updates b/ietf/bin/rfc-editor-queue-updates
index a279346c7..8d492967d 100755
--- a/ietf/bin/rfc-editor-queue-updates
+++ b/ietf/bin/rfc-editor-queue-updates
@@ -3,7 +3,6 @@
 import os
 import socket
 import sys
-from six.moves.urllib.request import urlopen
 
 # boilerplate
 basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
@@ -21,7 +20,7 @@ from ietf.utils.log import log
 log("Updating RFC Editor queue states from %s" % settings.RFC_EDITOR_QUEUE_URL)
 
 socket.setdefaulttimeout(30)
-response = urlopen(settings.RFC_EDITOR_QUEUE_URL)
+response = requests.get(settings.RFC_EDITOR_QUEUE_URL).text
 drafts, warnings = parse_queue(response)
 for w in warnings:
     log(u"Warning: %s" % w)