From 503b2fd62b1efb1dea39305c956f70d3128c5259 Mon Sep 17 00:00:00 2001 From: Raphael Roberts Date: Thu, 27 Sep 2018 23:27:40 -0500 Subject: [PATCH] removed request dependency --- ctabus.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ctabus.py b/ctabus.py index 8c3175c..68c0dcb 100644 --- a/ctabus.py +++ b/ctabus.py @@ -1,5 +1,5 @@ from urllib.parse import urlencode -from requests import get +from urllib.request import urlopen import json import os.path as osp with open(osp.join(osp.dirname(__file__),'cta_api_key')) as file: @@ -10,8 +10,8 @@ def get_data(type,api_key = api,**args): args['key'] = api_key args['format'] = 'json' url = base_url.format(type = type,query = urlencode(args)) - response = get(url) - data = json.loads(response.text)['bustime-response'] + response = urlopen(url) + data = json.load(response)['bustime-response'] try: data['error'] raise Exception(str(data["error"]))