From 1da05883511b4f94907ff1dcbf53a9a4cfe71a9f Mon Sep 17 00:00:00 2001 From: kevinhippert Date: Fri, 22 May 2020 12:29:01 -0500 Subject: [PATCH] Fix module import problems StringIO and urlopen were changed to different modules. This fixes those issues. --- .../controllers/cdrs_controller.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/flowroutenumbersandmessaging/controllers/cdrs_controller.py b/flowroutenumbersandmessaging/controllers/cdrs_controller.py index 969ad39..4d03f94 100644 --- a/flowroutenumbersandmessaging/controllers/cdrs_controller.py +++ b/flowroutenumbersandmessaging/controllers/cdrs_controller.py @@ -8,8 +8,10 @@ from csv import DictReader import gzip import json -import StringIO -import urllib2 +#import StringIO +from io import StringIO +#import urllib2 +from urllib.request import urlopen from .base_controller import BaseController from ..api_helper import APIHelper @@ -190,7 +192,7 @@ class CDRsController(BaseController): export_url = _response['data']['attributes']['download_url'] #urllib.urlretrieve(export_url, filename) try: - response = urllib2.urlopen(export_url) + response = urlopen(export_url) compressedFile = StringIO.StringIO(response.read()) decompressedFile = gzip.GzipFile(fileobj=compressedFile) with open(filename, 'w') as outfile: @@ -221,4 +223,4 @@ class CDRsController(BaseController): fileinfo = DictReader(infile) return list(fileinfo) except Exception as e: - raise Exception("Error parsing CDR Export data {}".format(e)) \ No newline at end of file + raise Exception("Error parsing CDR Export data {}".format(e))