cliqz-oss / privacy-bot

Privacy Bot gathers, persists and analyzes privacy policies. #Mozilla Global Sprint Project
https://cliqz-oss.github.io/privacy-bot/
GNU Affero General Public License v3.0
39 stars 16 forks source link

Create programmatic API to load privacy policy data. #3

Closed ecnmst closed 7 years ago

ecnmst commented 7 years ago
remusao commented 7 years ago

It is now possible to use the policies module to access the latest snapshot of the data and start working with it:

import policies

# Load latest snapshot
policies = Policies()

# Iterate on all policies
for policy in policies:
    print(policies)

# Check available domains, tlds, languages
print(policies.domains)
print(policies.tlds)
print(policies.languages)

# Access a specific policy
print('google.de' in policies)
print(policies['google.de'])

# Query policy by: tld, domain, lang
for policy in policies.query(lang='de'):
    print(policy.domain)

for policy in policies.query(lang='de', domain='youtube'):
    print(policy.domain)