Giter Club home page Giter Club logo

catchpoint-api-python's Introduction

Catchpoint API Python Module

Description

Catchpoint has two types of APIs, a push (subscriber) API and a pull REST API. This module is a wrapper for the REST API (which is still in alpha as of June 2014).

API documentation is available to Catchpoint customers.

Requirements

Tested on Python 2.7.5

Modules:

  • datetime
  • pytz
  • requests

Installation

python setup.py install

Usage

# import the module
import catchpoint

# define your catchpoint credentials
creds = {
    'client_id': 'yourclientid',
    'client_secret': 'yourclientsecret'
}

# create a Catchpoint object
cp = catchpoint.Catchpoint()

# query the API, always pass the creds
print cp.favorite_charts(creds)
print cp.favorite_details(creds, myfav)

Methods

Method Description Parameters
raw Retrieve the raw performance chart data for a given test for a time period. creds, testid, startTime, endTime, tz="UTC"
favorite_charts Retrieve the list of favorite charts. creds
favorite_details Retrieve the favorite chart details. creds, favid
favorite_data Retrieve the data for a favorite chart, optionally overriding its timeframe or test set. creds, favid, startTime=None, endTime=None, tz="UTC", tests=None
nodes Retrieve the list of nodes for the API consumer. creds
node Retrieve a given node for the API consumer. creds, node

Parameters

Param Type Description
creds dict Contains the Catchpoint client_id and client_secret
testid str The Catchpoint test ID
favid str The Catchpoint favorite ID
startTime str or int UTC formatted ("2014-06-19T12:51:37Z") time to begin requested dataset. Can be expressed as a negative integer when endTime = 'now'.
endTime str UTC formatted ("2014-06-19T12:51:37Z") time to end requested dataset. Can be expressed as 'now' to use current time.
tz str Optionally set the timezone to correlate to the Catchpoint test's configuration.
tests str Specify a comma-separated list of tests when retreiving a favorite chart.
node str The Catchpoint node id.

Relative Time Requests

Catchpoint's API requires specific UTC formatted timestamps when requesting datasets. These can be made relative by setting startTime to a negative integer that represents number of minutes into the past, and set endTime to 'now'.

Example for retreiving the last 60 minutes of data:

cp = catchpoint.Catchpoint()
myfav = "12345"
startTime = -60
endTime = "now"
print cp.favorite_data(creds, myfav, startTime, endTime)

License

GPL v2

catchpoint-api-python's People

Contributors

hanpeter avatar jasonarewhy avatar klynch avatar

Watchers

 avatar  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.