From e70455471a0c58ba513ecefb0d2d9ae970f18ef4 Mon Sep 17 00:00:00 2001 From: Parin Porecha Date: Tue, 19 Sep 2017 13:26:04 +0530 Subject: [PATCH] Start using url-normalize package instead of urltools for URL normalization --- semantics3/semantics3.py | 8 ++++---- setup.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/semantics3/semantics3.py b/semantics3/semantics3.py index 2eded0a..5b36b48 100644 --- a/semantics3/semantics3.py +++ b/semantics3/semantics3.py @@ -1,6 +1,6 @@ import json from requests_oauthlib import OAuth1Session -from urltools import normalize +from url_normalize import url_normalize try: import urllib.parse as urllib @@ -38,7 +38,7 @@ def __init__(self, api_key=None, api_secret=None, endpoint=None, api_base='https self.api_base = api_base def fetch(self, method, endpoint, params): - api_endpoint = normalize(self.api_base + endpoint) + api_endpoint = url_normalize(self.api_base + endpoint) if method.lower() in ['get', 'delete']: content = self.oauth.request( method, @@ -121,7 +121,7 @@ def query(self, method, endpoint, kwargs): response_json = response.json() except: raise Exception("Malformed JSON") - + if response.status_code < 400: return response.json() else: @@ -149,7 +149,7 @@ def run_query(self, endpoint=None, method='GET', params=None): params ) return self.query_result - + def get(self, endpoint=None): return self.run_query(endpoint) diff --git a/setup.py b/setup.py index 0a3492c..da4df3d 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ install_requires = [ 'requests-oauthlib >= 0.4.0', - 'urltools == 0.3.2' + 'url-normalize' ] def read(fname): try: