Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: python
python:
- "2.7"


# command to install dependencies
install:
- pip install .

# command to run tests
script: echo foo
29 changes: 29 additions & 0 deletions paralleldots/abusive_content
Original file line number Diff line number Diff line change
@@ -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"