From 8ea83f0ae2aa8fcb695c2bdbe6b272e9be0352b6 Mon Sep 17 00:00:00 2001 From: Shruti Date: Thu, 27 Jul 2017 18:28:01 +0530 Subject: [PATCH 1/9] API to fetch abusive content detector url, missing in Docs --- abusive_content | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 abusive_content diff --git a/abusive_content b/abusive_content new file mode 100644 index 0000000..93ef3ac --- /dev/null +++ b/abusive_content @@ -0,0 +1,29 @@ +from paralleldots.config import get_api_key + +import requests + +import json + + + +def get_abusive_content( text ): + + apikey = get_api_key() + + + + if not apikey == None: + + if type( text ) != str: + + return "Input must be a string." + + elif text == "": + + return "Input string cannot be empty." + + + + url = "http://apis.paralleldots.com/abuse" + + params = { "apikey": apikey, "text": text } + + + + #post call to abusive content detector + + r = requests.post( url, json.dumps(params)) + + + + if r.status_code != 200: + + return "Oops something went wrong ! You can raise an issue at https://github.com/ParallelDots/ParallelDots-Python-API/issues." + + + + r = json.loads( r.text ) + + + + r["usage"] = "By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions" + + return r + + + + else: + + return "API key does not exist" From f16da201b9fd9889656be084f9252a238e48d4db Mon Sep 17 00:00:00 2001 From: Shruti Date: Thu, 27 Jul 2017 18:29:18 +0530 Subject: [PATCH 2/9] Delete abusive_content --- abusive_content | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 abusive_content diff --git a/abusive_content b/abusive_content deleted file mode 100644 index 93ef3ac..0000000 --- a/abusive_content +++ /dev/null @@ -1,29 +0,0 @@ -from paralleldots.config import get_api_key - +import requests - +import json - + - +def get_abusive_content( text ): - + apikey = get_api_key() - + - + if not apikey == None: - + if type( text ) != str: - + return "Input must be a string." - + elif text == "": - + return "Input string cannot be empty." - + - + url = "http://apis.paralleldots.com/abuse" - + params = { "apikey": apikey, "text": text } - + - + #post call to abusive content detector - + r = requests.post( url, json.dumps(params)) - + - + if r.status_code != 200: - + return "Oops something went wrong ! You can raise an issue at https://github.com/ParallelDots/ParallelDots-Python-API/issues." - + - + r = json.loads( r.text ) - + - + r["usage"] = "By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions" - + return r - + - + else: - + return "API key does not exist" From 75023cd383e13a11a40f2836308602567564804c Mon Sep 17 00:00:00 2001 From: Shruti Date: Thu, 27 Jul 2017 18:30:36 +0530 Subject: [PATCH 3/9] API to fetch abusive content filter URL shown in demo added, missing in Docs --- paralleldots/abusive_content | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 paralleldots/abusive_content diff --git a/paralleldots/abusive_content b/paralleldots/abusive_content new file mode 100644 index 0000000..93ef3ac --- /dev/null +++ b/paralleldots/abusive_content @@ -0,0 +1,29 @@ +from paralleldots.config import get_api_key + +import requests + +import json + + + +def get_abusive_content( text ): + + apikey = get_api_key() + + + + if not apikey == None: + + if type( text ) != str: + + return "Input must be a string." + + elif text == "": + + return "Input string cannot be empty." + + + + url = "http://apis.paralleldots.com/abuse" + + params = { "apikey": apikey, "text": text } + + + + #post call to abusive content detector + + r = requests.post( url, json.dumps(params)) + + + + if r.status_code != 200: + + return "Oops something went wrong ! You can raise an issue at https://github.com/ParallelDots/ParallelDots-Python-API/issues." + + + + r = json.loads( r.text ) + + + + r["usage"] = "By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions" + + return r + + + + else: + + return "API key does not exist" From 0004a953d89f01fc270ca4a18484cfa1b0d5932f Mon Sep 17 00:00:00 2001 From: Shruti Date: Thu, 27 Jul 2017 18:38:59 +0530 Subject: [PATCH 4/9] Create .travis.yml --- .travis.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..084f64a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +language: python +python: + - "2.6" + - "2.7" + - "3.2" + - "3.3" + - "3.4" + - "3.5" + - "3.5-dev" # 3.5 development branch + - "3.6" +# command to install dependencies +install: "pip install -r requirements.txt" +# command to run tests +script: pytest From b8b37347f9735cced70f0b11fc69598df2c2a111 Mon Sep 17 00:00:00 2001 From: Shruti Date: Thu, 27 Jul 2017 18:44:08 +0530 Subject: [PATCH 5/9] pip changes --- .travis.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 084f64a..3e36fc5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,5 @@ python: - "3.5" - "3.5-dev" # 3.5 development branch - "3.6" -# command to install dependencies -install: "pip install -r requirements.txt" -# command to run tests -script: pytest + + From 2b238973a595a7514f3e36aeb383502f2ea5bf0a Mon Sep 17 00:00:00 2001 From: Shruti Date: Thu, 27 Jul 2017 18:52:46 +0530 Subject: [PATCH 6/9] install changes --- .travis.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3e36fc5..c0cb72c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,11 +2,11 @@ language: python python: - "2.6" - "2.7" - - "3.2" - - "3.3" - - "3.4" - - "3.5" - - "3.5-dev" # 3.5 development branch - - "3.6" - + +# command to install dependencies +install: + - pip install . + +# command to run tests +script: pytest From 9b741de1cc8ef392cea87a0ea3e3549af43af655 Mon Sep 17 00:00:00 2001 From: Shruti Date: Thu, 27 Jul 2017 18:55:15 +0530 Subject: [PATCH 7/9] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c0cb72c..e05fcd5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,4 +9,4 @@ install: - pip install . # command to run tests -script: pytest +#script: pytest From 4f10c42c0a6da6a63bba5aa038a4d643f0b55338 Mon Sep 17 00:00:00 2001 From: Shruti Date: Thu, 27 Jul 2017 18:58:41 +0530 Subject: [PATCH 8/9] Update .travis.yml --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e05fcd5..73d22e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: python python: - - "2.6" - "2.7" @@ -9,4 +8,4 @@ install: - pip install . # command to run tests -#script: pytest +#script: echo foo From 4f8d5d41dbd2cfc181d9d1f293c418f3f12630b1 Mon Sep 17 00:00:00 2001 From: Shruti Date: Thu, 27 Jul 2017 19:01:37 +0530 Subject: [PATCH 9/9] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 73d22e5..a2811f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,4 +8,4 @@ install: - pip install . # command to run tests -#script: echo foo +script: echo foo