/m2x-demo-heroku-python

AT&T M2X Heroku Demo Application for Python

Primary LanguagePythonMIT LicenseMIT

M2X Heroku Python Demo

Introduction

This is an example of a Heroku application written in Python that reports data to AT&T M2X. The application reports the current stock price of AT&T's stock (ticker symbol "T") every minute.

Please note that the Heroku machine and M2X are using times in UTC, not in your local time zone. M2X will, however, accept data in any time zone as long as the timestamp is formatted using ISO8601 (e.g. "2015-02-27T18:14:00.000-03:00").

Deploy

Pre-Requisites

You will need to have an account on Heroku. Because this example application uses only one Heroku dyno, it should be free for you to use, no matter how many other applications you have.

Installation

Deploying your application

Click the Heroku button to deploy your application to Heroku:

Deploy

Scaling Your Application

Because the application uses the "Clock" process type, your code isn't running yet. You need to scale the number of clock workers to 1.

Go to the Resources tab on your application's dashboard on Heroku and scale the clock python master.py process so that it uses one dyno.

Optionally, you can do this using the CLI:

heroku ps:scale clock=1

Notice that the Heroku Toolbelt must be installed and configured with your Heroku login credentials for this to work.

Testing

The application should now be reporting the price of AT&T's stock to AT&T M2X every minute. Go to your app dashboard on Heroku and click on the AT&T M2X add-on to access AT&T M2X's Developer Portal and confirm the data is being reported (please note that the NYSE is open from 9:30 AM to 4 PM Eastern Time, so the stock price reported outside those hours will not change.)

License

This library is released under the MIT license. See LICENSE for the terms.