sape /

Filename Size Date modified Message
71 B
39 B
1.5 KB
1.6 KB
1.5 KB


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' into settings.TEMPLATE_CONTEXT_PROCESSORS
  • 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|safeseq|join:", " }} in the template

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', '')