Git Product home page Git Product logo

apico's Introduction

apico Badge Badge 2

The easy way to monitor changes in RESTful APIs.

Installation

$ pip install apico

Example usage

from apico import Monitor, Response


monitor = Monitor(url='https://api.github.com/users/itsmewulf', rate=10.0, headers={'Authorization': 'GITHUB_TOKEN'})

@monitor.listener()
def on_change(old, new):
    print('Something changed!')
    
@monitor.listener('no_change')
def nothing_changed():
    print('Nothing changed!')
    
@monitor.listener()
def on_request():
    print('This is called before every request.')
    

monitor.start()

Some reference

Events

The events supported by the Monitor.listener decorator are:

  • change
  • request
  • no_change

As you can see in the example, listeners can be registered by passing the event name straight to the decorator (monitor.listener('change')) or inferred from the function name starting with on_:

@monitor.listener()
def on_change(...):

Monitor arguments

The monitor accepts a boatload of arguments, mainly ones that are then passed down to requests.Session.request(), so, for a detailed insight follow the hyperlink or read the docstring.

Returns

The responses returned by apico are actually instances of requests.Response

Rate

The rate at which the Monitor sends requests is controlled via the rate parameter, which is either an integer, or a float - 33 is a request every 33 seconds, 0.5 is 2 requests every second.


Reporting Issues

If you find any error/bug/mistake with the package or in the code feel free to create an issue and report it here.

Fix/Edit Content

If you wish to contribute to this package, fork the repository, make your changes and then simply create a Pull Request!

apico's People

Contributors

bwv2 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

apico's Issues

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.