This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

An async client for mixpanel.

Project Description

Tornado Mixpanel is an async library for Mixpanel service. This library allows for server-side integration of Mixpanel.

Installation

Automatic installation:

$ pip install tornado-mixpanel

Tornado Mixpanel is listed in PyPI and can be installed with pip or easy_install.

Manual installation: Download the latest source from PyPI.

tar xvzf tornado-mixpanel-$VERSION.tar.gz
cd tornado-mixpanel-$VERSION
python setup.py build
sudo python setup.py install

The Tornado Mixpanel source code is hosted on GitHub.

Example

Here is a simple example:

#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-

import traceback
from tornado import gen, ioloop
from tornado_mixpanel.client import AsyncMixpanelClient


@gen.coroutine
def run():
    client = AsyncMixpanelClient('<mixpanel-token>')
    raw_input('Press (enter) to continue...')

    try:
        r = yield client.track(
            'user-xxxx', 'steps', {'step_one': True, 'step_two': False})
        print r

        r = yield client.people_set(
            'client-xxxx', {'fullname': 'Alejandro Bernardis'})
        print r

        r = yield client.people_append(
            'client-xxxx', {'age': 31, 'locale': 'es_AR'})
        print r

    except:
        print traceback.format_exc()

    ioloop.IOLoop.current().stop()


if __name__ == '__main__':
    run()
    ioloop.IOLoop.instance().start()

And buffer example:

#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-

import time
import traceback
from tornado import gen, ioloop
from tornado_mixpanel.client import AsyncMixpanelClient


@gen.coroutine
def run():
    client = AsyncMixpanelClient('<mixpanel-token>', True)
    raw_input('Press (enter) to continue...')

    try:
        username = int(time.time())
        print 'Tracking...'

        for i in xrange(10):
            yield client.track(username, 'item_%s' % i, {'i': i})
            time.sleep(1)
        print '-*-' * 20

        r = yield client.consumer.flush()
        print r

    except:
        print traceback.format_exc()

    ioloop.IOLoop.current().stop()


if __name__ == '__main__':
    run()
    ioloop.IOLoop.instance().start()

License

The MIT License (MIT)

Copyright (c) 2015 Alejandro Bernardis and contributors. See AUTHORS for more details.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Release History

Release History

This version
History Node

0.2

History Node

0.1

History Node

0.1-dev

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
tornado-mixpanel-0.2.tar.gz (9.2 kB) Copy SHA256 Checksum SHA256 Source Mar 27, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting