sape / README.txt


Just install `sape` package via easy_install, pip or from repository.

Repository URL:

Usage in django project

 * Create directory where local links database should be saved
 * Put 'sape.django' into settings.INSTALLED_APPS
 * Put 'sape.django.context_processors.sape'
 * Put path to local links database into settings.SAPE_DATABASE
 * Put account ID to settings.SAPE_USER
 * Put site hostname to settings.SAPE_HOST
 * Setup cron to run periodically the command ` sape_refresh`.
   That command download fresh version of links database.
   Sample cron entry: * * * * * cd /web/project; ./ sape_refresh
 * Put `{{ sape.links|join:", " }} on appropriate place in the site's templates

Usage in arbitrary python project

 * Write script which calls sape.provider.refresh_local_database function and passes
   it correct arguments (path to local database, account ID, site hostname)
 * Call that script periodically with cron or anything else
 * Use sape.client.Client instance to get links for the page.

Example of Client usage

    from sape.client import Client

    url = ''
    client = Client('var/links.db', url)
    links = client.links()

Example of Provider usage

    from sape.provider import refresh_local_database

    refresh_local_database('var/links.db', ' ID', '')