Skip to content
Snippets Groups Projects
Commit a436ee3c authored by Cain, Payton David's avatar Cain, Payton David
Browse files

Update urllib2 to urllib

parent 92ad7b88
No related branches found
No related tags found
2 merge requests!146Release CMO metadata to production,!44Update urllib2 to urllib
...@@ -11,7 +11,7 @@ import itertools ...@@ -11,7 +11,7 @@ import itertools
import json import json
import os import os
import sys import sys
import urllib2 import urllib.request
############################################################################ ############################################################################
...@@ -54,7 +54,7 @@ url = ( ...@@ -54,7 +54,7 @@ url = (
try: try:
print(f"Loading data from web service\n\t{url}", file=sys.stderr) print(f"Loading data from web service\n\t{url}", file=sys.stderr)
response = urllib2.urlopen( response = urllib.request.urlopen(
url, url,
# allow environment certificate bundle override # allow environment certificate bundle override
cafile=os.environ.get("SSL_CERT_FILE"), cafile=os.environ.get("SSL_CERT_FILE"),
...@@ -125,7 +125,7 @@ calfile.append("") ...@@ -125,7 +125,7 @@ calfile.append("")
filename = FILENAME_FORMAT.format(OBSERVATORY=OBSERVATORY, YEAR=YEAR) filename = FILENAME_FORMAT.format(OBSERVATORY=OBSERVATORY, YEAR=YEAR)
print("Writing cal file to {}".format(filename), file=sys.stderr) print("Writing cal file to {}".format(filename), file=sys.stderr)
with open(filename, "wb", -1) as f: with open(filename, "wb", -1) as f:
f.write(os.linesep.join(calfile)) f.write(os.linesep.join(calfile).encode())
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment