Skip to content
This repository has been archived by the owner on Jun 8, 2020. It is now read-only.

Q: suggested way of implementing polled data fetcher #6

Closed
marks opened this issue Oct 6, 2013 · 1 comment
Closed

Q: suggested way of implementing polled data fetcher #6

marks opened this issue Oct 6, 2013 · 1 comment

Comments

@marks
Copy link

marks commented Oct 6, 2013

I understand webhooks for github deploy events or tracking web page views but what about data that one only wants to pull in on a daily basis (or when a webhook/push is not viable)? Some examples off the top of my head:

  • Track twitter followers (want to insert into db each night)
  • Ingest fitbit/other tracker data that does not support webhooks
  • Potentially syncing with MS HealthVault

Thanks!

@SamyPesse
Copy link
Member

For example for tracking Twitter followers, you will need to add a tache cron which will send an unique event for every follower (using the id argument in the events/track to avoid duplicate).

Example in python:

from reportr import Reportr

# Create a Reportr Client
client = Reportr(
    host="http://www.reportr.io",
    token="--token--")

# Define model for our event
client.model("twitter", "follower",
    name="Followers",
    description="Number of twitter followers.",
    icon="$twitter")

# Get followers
followers = twitter.get_followers()

for follower in followers:
    # Track the follower
    # id=follower.username is used to be sure to not rack twice the same follower
    client.track("twitter", "follower", id=follower.username, properties={
        "username": follower.username,
    })

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants