Sitelink 2 Developer Examples

This directory contains a number of python files to demonstrate using the Sitelink 2 APIs.

Setup

In order to use our APIs, you need a site. You can make a new one, or use one from the web page.

Make a new site

The file make_site.py will create one for you. To use it,

  1. review the settings.json file and make any changes that seem sensible.
  2. run python make_site.py
  3. a new site.json file will be created that adds settings used by the other python files.

Use an existing site

This is a bit painful at the moment; we intend to provide a nice web widget to get the settings you need but until then:

MFK data

The following files demonstrate our MFK data:

  1. mfk_send_replicates.py will send replicate packets to your site, at a rate of one packet each three seconds.
  2. mfk_live_reader.py will read replicate packets sent to your site.

Setting up two separate processes to run each of these will test that data are flowing correctly.

In addition, mfk.py provides classes used to manage mfk data. This file is used by the mfk_live_reader.

File examples

The file file_example.py provides a composite demonstration of the file upload feature of Sitelink 2. It

  1. creates a directory in the file system
  2. loads files into that directory
  3. lists the files
  4. downloads them again and
  5. tests that each file matches.

The individual functions are demonstrated in the following: