Changed some cases of urlopen() to use requests.get()

- Legacy-Id: 17374
This commit is contained in:
Henrik Levkowetz 2020-03-02 15:18:00 +00:00
parent 94e4dc7c74
commit 5d824b59c2
3 changed files with 4 additions and 8 deletions

View file

@ -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)

View file

@ -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))

View file

@ -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)