From 77fe8182f223091632bdaab43df831e8fae84994 Mon Sep 17 00:00:00 2001 From: Eugene Chepurniy Date: Thu, 30 Apr 2015 14:37:29 +0300 Subject: [PATCH] Removed re which was used to strip web responce - simple python statements used to strip --- ec2instancespricing.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ec2instancespricing.py b/ec2instancespricing.py index 1608a5e..d80a204 100755 --- a/ec2instancespricing.py +++ b/ec2instancespricing.py @@ -24,7 +24,6 @@ import urllib2 import argparse import datetime -import re import demjson EC2_REGIONS = [ @@ -288,12 +287,8 @@ def _load_data(url, use_cache=False, cache_class=SimpleResultsCache): f = urllib2.urlopen(url) request = f.read() - # strip initial comment (with newline) - modified_request = re.sub(re.compile(r'/\*.*\*/\n', re.DOTALL), '', request) - # strip from front of request - modified_request = re.sub(r'^callback\(', '', modified_request) - # strip from end of request - modified_request = re.sub(r'\);*$', '', modified_request) + # strip non JSON data from responce + modified_request = request.split('\n')[-1][:-2][9:] json = demjson.decode(modified_request)