Skip to main content

Leftronicd

A script to periodically post information to leftronic.com

Installation

  • Make a virtualenv

  • pip install leftronicd

Configuration

Configuration is done in yaml.

accesskey

Your leftronic API access key.

streams

A list of stream configurations.

Each stream requires following values:

  • method: The method that generates the value

  • type: The type of value (eg number or leaderboard)

  • name: Name of the stream

  • verbosename: Verbose name of the stream

  • interval: Interval in seconds when the method should be called.

Any other key-value pairs will be passed into the method.

Example:

accesskey: SECRET
streams:
    - method: leftronicd.contrib.github.repo_metric
      verbosename: django CMS Watchers
      name: django-cms-watchers
      type: number
      interval: 86400
      repo: divio/django-cms
      metric: watchers
    - method: leftronicd.contrib.github.repo_metric
      verbosename: django CMS Forks
      type: number
      interval: 86400
      name: django-cms-forks
      repo: divio/django-cms
      metric: forks

Built-in methods

leftronicd.contrib.github.repo_metric

Reports a metric from a github repository.

Configuration:

  • repo: The repo name, eg ojii/leftronicd

  • metric: Which value to grab from the repo, eg forks

Optional configuration:

  • username: The username (for private repos)

  • password: The password (for private repos)

Running

leftronicd <configfile> [-v]

Custom methods

Custom data collecting methods can be any Python callable that returns a Twisted Deferred which calls attached callbacks with the value to be posted to leftronic.com.

The Python callable is called with all additional configuration parameters given for a stream.

Example

This example will show the amount of GitHub followers a user has.

Python code (let’s assume it’s in a module called ‘custom’):

from leftronicd.helpers import get_page
import json

def github_followers(username):
    def handler(data):
        return json.loads(data)['followers']
    return get_page(handler, 'https://api.github.com/users/%s' % username)

As you can see, we use the leftronicd.helpers.get_page helper here, for details, see below.

Stream configuration:

accesskey: SECRET
streams:
    - method: custom.github_followers
      verbosename: Github Followers
      name: my-github-followers
      type: number
      interval: 300
      username: ojii

Helpers

leftronicd.helpers.get_page

A wrapper around twisted.web.client.getPage. Takes a handler function as first argument which is called with the content of the page if the page is loaded successful. The handler function should then return the value to be passed to leftronic. get_page returns a deferred which can be returned from your custom methods.

All arguments after the handler argument are the same as in twisted.web.client.getPage.

Metadata

Release files for leftronicd_db 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for leftronicd_db 0.1.2
File Size Uploaded Provenance Actions
leftronicd_db-0.1.2.zip 10.4 kB Without provenance Details for leftronicd_db-0.1.2.zip

Built distribution (wheel)

Table of built distributions (wheels) for leftronicd_db 0.1.2
File Interpreter ABI Platform Actions
leftronicd_db-0.1.2.win32.exe Details for leftronicd_db-0.1.2.win32.exe

Total release size: 217.5 kB

Release files / leftronicd_db-0.1.2.zip

Download URL leftronicd_db-0.1.2.zip
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f659dff59ad0df3c8dbb07d827a8c2c7d4597c5caf3688d4248aae12d5fa17c3
BLAKE2b-256 checksum
How to use checksums
a0071137879d66ee6706833ca7d0f723323bd2236d6c999dff49e9ffcad60eb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / leftronicd_db-0.1.2.win32.exe

Download URL leftronicd_db-0.1.2.win32.exe
Size 207.1 kB
Tags Source
SHA-256 checksum
How to use checksums
208bbd672a6b6dc2519a14972e3fbdf0219b17717c2da51578f8affdd5f990ce
BLAKE2b-256 checksum
How to use checksums
37f237c466c538cc1eb89861455bc3b065598627839237cf3dfe308b3aff849f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for leftronicd_db 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page