Giter VIP home page Giter VIP logo

striketracker's Introduction

striketracker

Python client and command line interface to the Highwinds CDN

Build Status

Installation instructions

striketracker is available via pip. To install, run

pip install striketracker

Usage

striketracker [command] [options]

Run striketracker --help to get a list of current commands.

Authenticating

There are two ways to authenticate calls to the API from the command line client. If you wish to securely store your token locally so you don't have to enter it each time, you can simply run striketracker init and enter your username and password.

If you wish to enter your token when issuing a command, simply use the --token parameter to specify the token you wish to use to perform the operation, for example:

striketracker me --token 3mux90t8mu4890t39xtw93mytmw3yc0t93u90rxxt33ijk

To authenticate from the Python library, log into StrikeTracker and obtain an API token from the Edit Profile link under the user menu on the top right of the application. This is a revocable API token that you can use to integrate applications with the StrikeTracker API. Store this token in a secure place, generally an environment variable on the production server that will be running your application. Then pass this as the token parameter to the APIClient.

Example

To purge from the command line, simply run the purge command with your account hash and provide newline-delimited URLs on stdin. You can use the --poll parameter in order to wait for the purge to complete before exiting. For example:

$ echo //www.example.com/style.css | striketracker purge x1x2x3x4 --poll
Reading urls from stdin
Sending purge.................Done!

Here is an example of the same purge issued via the Python library bundled with the application:

from striketracker import APIClient
import sys
import time

# Initialize client
client = APIClient(token='your token here')

# Send purge request
sys.stdout.write('Sending purge...')
sys.stdout.flush()
job_id = client.purge('x1x2x3x4', [
    {"url": "//www.example.com/style.css"}
])

# Poll for purge completion
while client.purge_status('x1x2x3x4', job_id) < 1.0:
    sys.stdout.write('.')
    sys.stdout.flush()
    time.sleep(0.5)
sys.stdout.write('Done!\n')

Integrating with testing environments

In order to integrate against testing environments, simply populate the STRIKETRACKER_BASE_URL environment variable without a trailing slash.

export STRIKETRACKER_BASE_URL=https://striketracker.highwinds.com

striketracker's People

Contributors

sircortly avatar thinkjson avatar wcs1only avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.