From 7ded5aa1bfed679bace8eee2314e32ab62257c8d Mon Sep 17 00:00:00 2001 From: "M. Jackson Wilkinson" Date: Wed, 8 Apr 2015 08:54:00 -0400 Subject: [PATCH 1/9] PEP8: Indentation -> 4 spaces --- lymbix.py | 248 +++++++++++++++++++++++++++--------------------------- 1 file changed, 124 insertions(+), 124 deletions(-) diff --git a/lymbix.py b/lymbix.py index deb4da8..1d95af1 100644 --- a/lymbix.py +++ b/lymbix.py @@ -3,138 +3,138 @@ import json class Lymbix: - - API_BASE = 'https://gyrus.lymbix.com/'; - TONALIZE_MULTIPLE = 'tonalize_multiple'; - TONALIZE_DETAILED = 'tonalize_detailed'; - TONALIZE = 'tonalize'; - FLAG_RESPONSE = 'flag_response'; + + API_BASE = 'https://gyrus.lymbix.com/'; + TONALIZE_MULTIPLE = 'tonalize_multiple'; + TONALIZE_DETAILED = 'tonalize_detailed'; + TONALIZE = 'tonalize'; + FLAG_RESPONSE = 'flag_response'; - def __init__(self, authentication_key): - ''' - Args: - -authentication_key: your Lymbix authentication key - ''' - if authentication_key == None or len(authentication_key) == 0: - raise Exception('You must include your authentication key') + def __init__(self, authentication_key): + ''' + Args: + -authentication_key: your Lymbix authentication key + ''' + if authentication_key == None or len(authentication_key) == 0: + raise Exception('You must include your authentication key') + + self.authentication_key = authentication_key - self.authentication_key = authentication_key - - ''' utility functions ''' - - def _get_headers(self): - headers = { - 'Authentication': self.authentication_key, - 'Accept': 'application/json', - 'Version': '2.2'} - return headers - - ''' api methods ''' - - def tonalize_multiple(self, articles, options = None): - ''' - tonalize multiple articles + ''' utility functions ''' - Args: - -articles: articles to tonalize - -options: additional parameters (reference_ids and return_fields) - - Returns: - -see the api documentation for the format of this object - ''' - if articles == None or len(articles) == 0: - raise Exception('You must include articles to tonalize') - - url = self.API_BASE + self.TONALIZE_MULTIPLE - data = {'articles': articles} - if options != None: data.update(options) - for key, value in data.iteritems(): data[key] = json.dumps(value) - data = urllib.urlencode(data) + def _get_headers(self): + headers = { + 'Authentication': self.authentication_key, + 'Accept': 'application/json', + 'Version': '2.2'} + return headers - headers = self._get_headers() - request = urllib2.Request(url, data, headers) - response = urllib2.urlopen(request) - return json.loads(response.read()) - - def tonalize_detailed(self, article, options = None): - ''' - tonalize an article + ''' api methods ''' - Args: - -article: article to tonalize - -options: additional parameters (reference_id and return_fields) + def tonalize_multiple(self, articles, options = None): + ''' + tonalize multiple articles - Returns: - -see the api documentation for the format of this object - ''' - if article == None or len(article) == 0: - raise Exception('You must include an article to tonalize') - - url = self.API_BASE + self.TONALIZE_DETAILED - data = {'article': article} - if options != None: data.update(options) - for key, value in data.iteritems(): data[key] = json.dumps(value) - data = urllib.urlencode(data) - - headers = self._get_headers() - request = urllib2.Request(url, data, headers) - response = urllib2.urlopen(request) - return json.loads(response.read()) - - def tonalize(self, article, options = None): - ''' - tonalize an article + Args: + -articles: articles to tonalize + -options: additional parameters (reference_ids and return_fields) + + Returns: + -see the api documentation for the format of this object + ''' + if articles == None or len(articles) == 0: + raise Exception('You must include articles to tonalize') - Args: - -article: article to tonalize - -options: additional parameters (reference_id and return_fields) + url = self.API_BASE + self.TONALIZE_MULTIPLE + data = {'articles': articles} + if options != None: data.update(options) + for key, value in data.iteritems(): data[key] = json.dumps(value) + data = urllib.urlencode(data) - Returns: - -see the api documentation for the format of this object - ''' - if article == None or len(article) == 0: - raise Exception('You must include an article to tonalize') - - url = self.API_BASE + self.TONALIZE - data = {'article': article} - if options != None: data.update(options) - for key, value in data.iteritems(): data[key] = json.dumps(value) - data = urllib.urlencode(data) - - headers = self._get_headers() - request = urllib2.Request(url, data, headers) - response = urllib2.urlopen(request) - return json.loads(response.read()) + headers = self._get_headers() + request = urllib2.Request(url, data, headers) + response = urllib2.urlopen(request) + return json.loads(response.read()) - def flag_response(self, phrase, api_method = None, api_version = '2.2', callback_url = None, options = None): - ''' - flag a response as inaccurate + def tonalize_detailed(self, article, options = None): + ''' + tonalize an article + + Args: + -article: article to tonalize + -options: additional parameters (reference_id and return_fields) + + Returns: + -see the api documentation for the format of this object + ''' + if article == None or len(article) == 0: + raise Exception('You must include an article to tonalize') + + url = self.API_BASE + self.TONALIZE_DETAILED + data = {'article': article} + if options != None: data.update(options) + for key, value in data.iteritems(): data[key] = json.dumps(value) + data = urllib.urlencode(data) - Args: - -phrase: the phrase that returns an inaccurate response - -api_method: the method that returns an inaccurate response - -api_version: the version that returns an inaccurate response - -callback_url: a url to call when the phrase has been re-rated - -options: additional parameters (reference_id) + headers = self._get_headers() + request = urllib2.Request(url, data, headers) + response = urllib2.urlopen(request) + return json.loads(response.read()) + + def tonalize(self, article, options = None): + ''' + tonalize an article - Returns: - -see the api documentation for the format of this object - ''' - if phrase == None or len(phrase) == 0: - raise Exception('You must include a phrase to flag') - - url = self.API_BASE + self.FLAG_RESPONSE - data = {'phrase': phrase} - - if (api_method != None): data['apiMethod'] = api_method - if (api_version != None): data['apiVersion'] = api_version - if (callback_url != None): data['callbackUrl'] = callback_url - if (options != None): data.update(options) - - for key, value in data.iteritems(): data[key] = json.dumps(value) - data = urllib.urlencode(data) - - headers = self._get_headers() - request = urllib2.Request(url, data, headers) - response = urllib2.urlopen(request) - return response.read() \ No newline at end of file + Args: + -article: article to tonalize + -options: additional parameters (reference_id and return_fields) + + Returns: + -see the api documentation for the format of this object + ''' + if article == None or len(article) == 0: + raise Exception('You must include an article to tonalize') + + url = self.API_BASE + self.TONALIZE + data = {'article': article} + if options != None: data.update(options) + for key, value in data.iteritems(): data[key] = json.dumps(value) + data = urllib.urlencode(data) + + headers = self._get_headers() + request = urllib2.Request(url, data, headers) + response = urllib2.urlopen(request) + return json.loads(response.read()) + + def flag_response(self, phrase, api_method = None, api_version = '2.2', callback_url = None, options = None): + ''' + flag a response as inaccurate + + Args: + -phrase: the phrase that returns an inaccurate response + -api_method: the method that returns an inaccurate response + -api_version: the version that returns an inaccurate response + -callback_url: a url to call when the phrase has been re-rated + -options: additional parameters (reference_id) + + Returns: + -see the api documentation for the format of this object + ''' + if phrase == None or len(phrase) == 0: + raise Exception('You must include a phrase to flag') + + url = self.API_BASE + self.FLAG_RESPONSE + data = {'phrase': phrase} + + if (api_method != None): data['apiMethod'] = api_method + if (api_version != None): data['apiVersion'] = api_version + if (callback_url != None): data['callbackUrl'] = callback_url + if (options != None): data.update(options) + + for key, value in data.iteritems(): data[key] = json.dumps(value) + data = urllib.urlencode(data) + + headers = self._get_headers() + request = urllib2.Request(url, data, headers) + response = urllib2.urlopen(request) + return response.read() \ No newline at end of file From 31e52c825c25ae7bc816d5bb0afc5c02500026eb Mon Sep 17 00:00:00 2001 From: "M. Jackson Wilkinson" Date: Wed, 8 Apr 2015 08:55:35 -0400 Subject: [PATCH 2/9] PEP8: whitespace cleanup --- lymbix.py | 71 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/lymbix.py b/lymbix.py index 1d95af1..4cfb290 100644 --- a/lymbix.py +++ b/lymbix.py @@ -2,13 +2,14 @@ import urllib2 import json + class Lymbix: - - API_BASE = 'https://gyrus.lymbix.com/'; - TONALIZE_MULTIPLE = 'tonalize_multiple'; - TONALIZE_DETAILED = 'tonalize_detailed'; - TONALIZE = 'tonalize'; - FLAG_RESPONSE = 'flag_response'; + + API_BASE = 'https://gyrus.lymbix.com/' + TONALIZE_MULTIPLE = 'tonalize_multiple' + TONALIZE_DETAILED = 'tonalize_detailed' + TONALIZE = 'tonalize' + FLAG_RESPONSE = 'flag_response' def __init__(self, authentication_key): ''' @@ -17,124 +18,124 @@ def __init__(self, authentication_key): ''' if authentication_key == None or len(authentication_key) == 0: raise Exception('You must include your authentication key') - + self.authentication_key = authentication_key - + ''' utility functions ''' - + def _get_headers(self): headers = { 'Authentication': self.authentication_key, 'Accept': 'application/json', 'Version': '2.2'} return headers - + ''' api methods ''' - - def tonalize_multiple(self, articles, options = None): + + def tonalize_multiple(self, articles, options=None): ''' tonalize multiple articles - + Args: -articles: articles to tonalize -options: additional parameters (reference_ids and return_fields) - + Returns: -see the api documentation for the format of this object ''' if articles == None or len(articles) == 0: raise Exception('You must include articles to tonalize') - + url = self.API_BASE + self.TONALIZE_MULTIPLE data = {'articles': articles} if options != None: data.update(options) for key, value in data.iteritems(): data[key] = json.dumps(value) data = urllib.urlencode(data) - + headers = self._get_headers() request = urllib2.Request(url, data, headers) response = urllib2.urlopen(request) return json.loads(response.read()) - def tonalize_detailed(self, article, options = None): + def tonalize_detailed(self, article, options=None): ''' tonalize an article - + Args: -article: article to tonalize -options: additional parameters (reference_id and return_fields) - + Returns: -see the api documentation for the format of this object ''' if article == None or len(article) == 0: raise Exception('You must include an article to tonalize') - + url = self.API_BASE + self.TONALIZE_DETAILED data = {'article': article} if options != None: data.update(options) for key, value in data.iteritems(): data[key] = json.dumps(value) data = urllib.urlencode(data) - + headers = self._get_headers() request = urllib2.Request(url, data, headers) response = urllib2.urlopen(request) return json.loads(response.read()) - - def tonalize(self, article, options = None): + + def tonalize(self, article, options=None): ''' tonalize an article - + Args: -article: article to tonalize -options: additional parameters (reference_id and return_fields) - + Returns: -see the api documentation for the format of this object ''' if article == None or len(article) == 0: raise Exception('You must include an article to tonalize') - + url = self.API_BASE + self.TONALIZE data = {'article': article} if options != None: data.update(options) for key, value in data.iteritems(): data[key] = json.dumps(value) data = urllib.urlencode(data) - + headers = self._get_headers() request = urllib2.Request(url, data, headers) response = urllib2.urlopen(request) return json.loads(response.read()) - def flag_response(self, phrase, api_method = None, api_version = '2.2', callback_url = None, options = None): + def flag_response(self, phrase, api_method=None, api_version='2.2', callback_url=None, options=None): ''' flag a response as inaccurate - + Args: -phrase: the phrase that returns an inaccurate response -api_method: the method that returns an inaccurate response -api_version: the version that returns an inaccurate response -callback_url: a url to call when the phrase has been re-rated -options: additional parameters (reference_id) - + Returns: -see the api documentation for the format of this object ''' if phrase == None or len(phrase) == 0: raise Exception('You must include a phrase to flag') - + url = self.API_BASE + self.FLAG_RESPONSE data = {'phrase': phrase} - + if (api_method != None): data['apiMethod'] = api_method if (api_version != None): data['apiVersion'] = api_version if (callback_url != None): data['callbackUrl'] = callback_url if (options != None): data.update(options) - + for key, value in data.iteritems(): data[key] = json.dumps(value) data = urllib.urlencode(data) - + headers = self._get_headers() request = urllib2.Request(url, data, headers) response = urllib2.urlopen(request) - return response.read() \ No newline at end of file + return response.read() From 418df5a45abf70db79e4d9328c1c20dd3af882f1 Mon Sep 17 00:00:00 2001 From: "M. Jackson Wilkinson" Date: Wed, 8 Apr 2015 08:59:00 -0400 Subject: [PATCH 3/9] PEP8: comparisons to None --- lymbix.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lymbix.py b/lymbix.py index 4cfb290..8163559 100644 --- a/lymbix.py +++ b/lymbix.py @@ -16,7 +16,7 @@ def __init__(self, authentication_key): Args: -authentication_key: your Lymbix authentication key ''' - if authentication_key == None or len(authentication_key) == 0: + if authentication_key is None or len(authentication_key) == 0: raise Exception('You must include your authentication key') self.authentication_key = authentication_key @@ -43,12 +43,12 @@ def tonalize_multiple(self, articles, options=None): Returns: -see the api documentation for the format of this object ''' - if articles == None or len(articles) == 0: + if articles is None or len(articles) == 0: raise Exception('You must include articles to tonalize') url = self.API_BASE + self.TONALIZE_MULTIPLE data = {'articles': articles} - if options != None: data.update(options) + if options is not None: data.update(options) for key, value in data.iteritems(): data[key] = json.dumps(value) data = urllib.urlencode(data) @@ -68,12 +68,12 @@ def tonalize_detailed(self, article, options=None): Returns: -see the api documentation for the format of this object ''' - if article == None or len(article) == 0: + if article is None or len(article) == 0: raise Exception('You must include an article to tonalize') url = self.API_BASE + self.TONALIZE_DETAILED data = {'article': article} - if options != None: data.update(options) + if options is not None: data.update(options) for key, value in data.iteritems(): data[key] = json.dumps(value) data = urllib.urlencode(data) @@ -93,12 +93,12 @@ def tonalize(self, article, options=None): Returns: -see the api documentation for the format of this object ''' - if article == None or len(article) == 0: + if article is None or len(article) == 0: raise Exception('You must include an article to tonalize') url = self.API_BASE + self.TONALIZE data = {'article': article} - if options != None: data.update(options) + if options is not None: data.update(options) for key, value in data.iteritems(): data[key] = json.dumps(value) data = urllib.urlencode(data) @@ -121,16 +121,16 @@ def flag_response(self, phrase, api_method=None, api_version='2.2', callback_url Returns: -see the api documentation for the format of this object ''' - if phrase == None or len(phrase) == 0: + if phrase is None or len(phrase) == 0: raise Exception('You must include a phrase to flag') url = self.API_BASE + self.FLAG_RESPONSE data = {'phrase': phrase} - if (api_method != None): data['apiMethod'] = api_method - if (api_version != None): data['apiVersion'] = api_version - if (callback_url != None): data['callbackUrl'] = callback_url - if (options != None): data.update(options) + if (api_method is not None): data['apiMethod'] = api_method + if (api_version is not None): data['apiVersion'] = api_version + if (callback_url is not None): data['callbackUrl'] = callback_url + if (options is not None): data.update(options) for key, value in data.iteritems(): data[key] = json.dumps(value) data = urllib.urlencode(data) From f2679f02eb10a9c0121dea383d7f5c803477b5c0 Mon Sep 17 00:00:00 2001 From: "M. Jackson Wilkinson" Date: Wed, 8 Apr 2015 09:07:47 -0400 Subject: [PATCH 4/9] refactoring/DRYing preparation of `data` --- lymbix.py | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/lymbix.py b/lymbix.py index 8163559..947ea6b 100644 --- a/lymbix.py +++ b/lymbix.py @@ -30,6 +30,13 @@ def _get_headers(self): 'Version': '2.2'} return headers + def _prep_data(self, data, options): + if options: + data.update(options) + for key, value in data.iteritems(): + data[key] = json.dumps(value) + return urllib.urlencode(data) + ''' api methods ''' def tonalize_multiple(self, articles, options=None): @@ -48,9 +55,7 @@ def tonalize_multiple(self, articles, options=None): url = self.API_BASE + self.TONALIZE_MULTIPLE data = {'articles': articles} - if options is not None: data.update(options) - for key, value in data.iteritems(): data[key] = json.dumps(value) - data = urllib.urlencode(data) + data = self._prep_data(data, options) headers = self._get_headers() request = urllib2.Request(url, data, headers) @@ -72,10 +77,9 @@ def tonalize_detailed(self, article, options=None): raise Exception('You must include an article to tonalize') url = self.API_BASE + self.TONALIZE_DETAILED + data = {'article': article} - if options is not None: data.update(options) - for key, value in data.iteritems(): data[key] = json.dumps(value) - data = urllib.urlencode(data) + data = self._prep_data(data, options) headers = self._get_headers() request = urllib2.Request(url, data, headers) @@ -98,9 +102,7 @@ def tonalize(self, article, options=None): url = self.API_BASE + self.TONALIZE data = {'article': article} - if options is not None: data.update(options) - for key, value in data.iteritems(): data[key] = json.dumps(value) - data = urllib.urlencode(data) + data = self._prep_data(data, options) headers = self._get_headers() request = urllib2.Request(url, data, headers) @@ -125,15 +127,15 @@ def flag_response(self, phrase, api_method=None, api_version='2.2', callback_url raise Exception('You must include a phrase to flag') url = self.API_BASE + self.FLAG_RESPONSE - data = {'phrase': phrase} - if (api_method is not None): data['apiMethod'] = api_method - if (api_version is not None): data['apiVersion'] = api_version - if (callback_url is not None): data['callbackUrl'] = callback_url - if (options is not None): data.update(options) - - for key, value in data.iteritems(): data[key] = json.dumps(value) - data = urllib.urlencode(data) + data = {'phrase': phrase} + if (api_method is not None): + data['apiMethod'] = api_method + if (api_version is not None): + data['apiVersion'] = api_version + if (callback_url is not None): + data['callbackUrl'] = callback_url + data = self._prep_data(data, options) headers = self._get_headers() request = urllib2.Request(url, data, headers) From 072f118d39a46000b09bd9eb2920520e889be98f Mon Sep 17 00:00:00 2001 From: "M. Jackson Wilkinson" Date: Wed, 8 Apr 2015 09:12:32 -0400 Subject: [PATCH 5/9] Refactoring/DRYing http requests --- lymbix.py | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/lymbix.py b/lymbix.py index 947ea6b..53d5100 100644 --- a/lymbix.py +++ b/lymbix.py @@ -37,6 +37,14 @@ def _prep_data(self, data, options): data[key] = json.dumps(value) return urllib.urlencode(data) + def _call(self, url, data, json=False): + headers = self._get_headers() + request = urllib2.Request(url, data, headers) + response = urllib2.urlopen(request) + if json: + return json.loads(response.read()) + return response.read() + ''' api methods ''' def tonalize_multiple(self, articles, options=None): @@ -57,10 +65,7 @@ def tonalize_multiple(self, articles, options=None): data = {'articles': articles} data = self._prep_data(data, options) - headers = self._get_headers() - request = urllib2.Request(url, data, headers) - response = urllib2.urlopen(request) - return json.loads(response.read()) + return self._call(url, data, json=True) def tonalize_detailed(self, article, options=None): ''' @@ -81,10 +86,7 @@ def tonalize_detailed(self, article, options=None): data = {'article': article} data = self._prep_data(data, options) - headers = self._get_headers() - request = urllib2.Request(url, data, headers) - response = urllib2.urlopen(request) - return json.loads(response.read()) + return self._call(url, data, json=True) def tonalize(self, article, options=None): ''' @@ -104,10 +106,7 @@ def tonalize(self, article, options=None): data = {'article': article} data = self._prep_data(data, options) - headers = self._get_headers() - request = urllib2.Request(url, data, headers) - response = urllib2.urlopen(request) - return json.loads(response.read()) + return self._call(url, data, json=True) def flag_response(self, phrase, api_method=None, api_version='2.2', callback_url=None, options=None): ''' @@ -137,7 +136,4 @@ def flag_response(self, phrase, api_method=None, api_version='2.2', callback_url data['callbackUrl'] = callback_url data = self._prep_data(data, options) - headers = self._get_headers() - request = urllib2.Request(url, data, headers) - response = urllib2.urlopen(request) - return response.read() + return self._call(url, data) From a6d0dc96bf4c718f84e23f2a266f7574067beb6c Mon Sep 17 00:00:00 2001 From: "M. Jackson Wilkinson" Date: Wed, 8 Apr 2015 09:15:08 -0400 Subject: [PATCH 6/9] updating API hostname --- lymbix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lymbix.py b/lymbix.py index 53d5100..ad9de14 100644 --- a/lymbix.py +++ b/lymbix.py @@ -5,7 +5,7 @@ class Lymbix: - API_BASE = 'https://gyrus.lymbix.com/' + API_BASE = 'https://api.lymbix.com/' TONALIZE_MULTIPLE = 'tonalize_multiple' TONALIZE_DETAILED = 'tonalize_detailed' TONALIZE = 'tonalize' From 30a1069a57f9fd0baa1ab79a85d90679b04aec5e Mon Sep 17 00:00:00 2001 From: "M. Jackson Wilkinson" Date: Wed, 8 Apr 2015 11:39:24 -0400 Subject: [PATCH 7/9] Simplify tests for invalid values --- lymbix.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lymbix.py b/lymbix.py index ad9de14..89480cd 100644 --- a/lymbix.py +++ b/lymbix.py @@ -16,7 +16,7 @@ def __init__(self, authentication_key): Args: -authentication_key: your Lymbix authentication key ''' - if authentication_key is None or len(authentication_key) == 0: + if not authentication_key: raise Exception('You must include your authentication key') self.authentication_key = authentication_key @@ -58,7 +58,7 @@ def tonalize_multiple(self, articles, options=None): Returns: -see the api documentation for the format of this object ''' - if articles is None or len(articles) == 0: + if not articles: raise Exception('You must include articles to tonalize') url = self.API_BASE + self.TONALIZE_MULTIPLE @@ -78,7 +78,7 @@ def tonalize_detailed(self, article, options=None): Returns: -see the api documentation for the format of this object ''' - if article is None or len(article) == 0: + if not article: raise Exception('You must include an article to tonalize') url = self.API_BASE + self.TONALIZE_DETAILED @@ -99,7 +99,7 @@ def tonalize(self, article, options=None): Returns: -see the api documentation for the format of this object ''' - if article is None or len(article) == 0: + if not article: raise Exception('You must include an article to tonalize') url = self.API_BASE + self.TONALIZE @@ -122,7 +122,7 @@ def flag_response(self, phrase, api_method=None, api_version='2.2', callback_url Returns: -see the api documentation for the format of this object ''' - if phrase is None or len(phrase) == 0: + if not phrase: raise Exception('You must include a phrase to flag') url = self.API_BASE + self.FLAG_RESPONSE From f4605eef471b52494165a3839829e704d61c8144 Mon Sep 17 00:00:00 2001 From: "M. Jackson Wilkinson" Date: Wed, 8 Apr 2015 14:01:47 -0400 Subject: [PATCH 8/9] Typo error in json options --- lymbix.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lymbix.py b/lymbix.py index 89480cd..aa88fe6 100644 --- a/lymbix.py +++ b/lymbix.py @@ -37,11 +37,11 @@ def _prep_data(self, data, options): data[key] = json.dumps(value) return urllib.urlencode(data) - def _call(self, url, data, json=False): + def _call(self, url, data, returns_json=False): headers = self._get_headers() request = urllib2.Request(url, data, headers) response = urllib2.urlopen(request) - if json: + if returns_json: return json.loads(response.read()) return response.read() @@ -65,7 +65,7 @@ def tonalize_multiple(self, articles, options=None): data = {'articles': articles} data = self._prep_data(data, options) - return self._call(url, data, json=True) + return self._call(url, data, returns_json=True) def tonalize_detailed(self, article, options=None): ''' @@ -86,7 +86,7 @@ def tonalize_detailed(self, article, options=None): data = {'article': article} data = self._prep_data(data, options) - return self._call(url, data, json=True) + return self._call(url, data, returns_json=True) def tonalize(self, article, options=None): ''' @@ -106,7 +106,7 @@ def tonalize(self, article, options=None): data = {'article': article} data = self._prep_data(data, options) - return self._call(url, data, json=True) + return self._call(url, data, returns_json=True) def flag_response(self, phrase, api_method=None, api_version='2.2', callback_url=None, options=None): ''' From 25f65703b46de2984d01f3871d134f2af07be688 Mon Sep 17 00:00:00 2001 From: "M. Jackson Wilkinson" Date: Fri, 4 Sep 2015 09:01:50 -0400 Subject: [PATCH 9/9] Lymbix isn't working over https right now --- lymbix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lymbix.py b/lymbix.py index aa88fe6..fa8333c 100644 --- a/lymbix.py +++ b/lymbix.py @@ -5,7 +5,7 @@ class Lymbix: - API_BASE = 'https://api.lymbix.com/' + API_BASE = 'http://api.lymbix.com/' TONALIZE_MULTIPLE = 'tonalize_multiple' TONALIZE_DETAILED = 'tonalize_detailed' TONALIZE = 'tonalize'