The repository contains the source code powering the API service of PrivacySpy. It is used for text highlighting based on an individual sentence's importance (assuming the sentence is a part of a privacy policy). Dockerfile
is included.
Before proceeding, make sure you have Python 3.6 installed.
pip install -r requirements.txt
pip install -U spacy==2.0.3
python3 -m spacy download en
docker build -t privacyspy-api .
docker run -p 5000:5000 -t privacyspy-api
/analyze
GET
Parameters:
url
- URL of a privacy policy inapplication/x-www-form-urlencoded
formattoken
- PrivacySpy token that corresponds to the environment variable token of the service
OR
/analyze
POST
Parameters:
plain_text
- plain text of a privacy policyraw_html
- raw html of a web page in case plain_text is not submittedtoken
- PrivacySpy token that corresponds to the environment variable token of the service
Returns:
- In case of success, the API endpoint returns a JSON object of the following format:
{
"response": [
{
"score": 0.554556940669308,
"sentence": "What do we mean by \"personal information?\""
},
{
"score": 0.8253833221800004,
"sentence": "For us, \"personal information\" means information which identifies you, like your name or email address."
}, ...
],
"status": "success",
"version": "1.0"
}
- If there was an error,
status
will containerror
, and the response will contain the error message instead. Additionally, there will be anerror_code
field containing integer values corresponding to the error as follows:1
-- no URL provided2
-- no token provided3
-- invalid token4
-- failed to extract content from the URL5
-- privacy policy is not in English