当前位置: 首页>>代码示例>>Python>>正文


Python EventTracker.run方法代码示例

本文整理汇总了Python中mixpanel.tasks.EventTracker.run方法的典型用法代码示例。如果您正苦于以下问题:Python EventTracker.run方法的具体用法?Python EventTracker.run怎么用?Python EventTracker.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mixpanel.tasks.EventTracker的用法示例。


在下文中一共展示了EventTracker.run方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_old_run

# 需要导入模块: from mixpanel.tasks import EventTracker [as 别名]
# 或者: from mixpanel.tasks.EventTracker import run [as 别名]
    def test_old_run(self):
        """non-recorded events should return False"""
        et = EventTracker()
        # Times older than 3 hours don't get recorded according to: http://mixpanel.com/api/docs/specification
        # equests will be rejected that are 3 hours older than present time
        result = et.run('event_foo', {'time': 1245613885})

        self.assertFalse(result)
开发者ID:Crowdbooster,项目名称:mixpanel-celery,代码行数:10,代码来源:test_tasks.py

示例2: test_non_recorded

# 需要导入模块: from mixpanel.tasks import EventTracker [as 别名]
# 或者: from mixpanel.tasks.EventTracker import run [as 别名]
    def test_non_recorded(self):
        """non-recorded events should return False"""
        self.response.read.return_value = '0'

        et = EventTracker()
        # Times older than 3 hours don't get recorded according to:
        # http://mixpanel.com/api/docs/specification
        # requests will be rejected that are 3 hours older than present time
        # (though actually this is returnin False because of mocking network)
        result = et.run('event_foo', {'time': 1245613885})

        self.assertFalse(result)
开发者ID:datafyit,项目名称:mixpanel-celery,代码行数:14,代码来源:test_tasks.py

示例3: test_debug_logger

# 需要导入模块: from mixpanel.tasks import EventTracker [as 别名]
# 或者: from mixpanel.tasks.EventTracker import run [as 别名]
    def test_debug_logger(self):
        et = EventTracker()
        result = et.run('event_foo', {}, loglevel=logging.DEBUG)

        self.assertTrue(result)
开发者ID:andela,项目名称:mixpanel-celery,代码行数:7,代码来源:test_tasks.py

示例4: test_run

# 需要导入模块: from mixpanel.tasks import EventTracker [as 别名]
# 或者: from mixpanel.tasks.EventTracker import run [as 别名]
    def test_run(self):
        # "correct" result obtained from: http://mixpanel.com/api/docs/console
        et = EventTracker()
        result = et.run('event_foo', {})

        self.assertTrue(result)
开发者ID:andela,项目名称:mixpanel-celery,代码行数:8,代码来源:test_tasks.py

示例5: EventTracker

# 需要导入模块: from mixpanel.tasks import EventTracker [as 别名]
# 或者: from mixpanel.tasks.EventTracker import run [as 别名]
from guelphapi.api.utils.log import get_data

from tastypie.resources import Resource, ModelResource

from mixpanel.tasks import EventTracker

tracker = EventTracker()
track_event = lambda *a, **kw: tracker.run(*a, **kw)

class LoggingResource(Resource):
    def dispatch(self, request_type, request, **kwargs):
        # Let the "real" dispatch do its thing.
        # This includes checking a throttle, authentication, authorization, etc
        response = super(LoggingResource, self).dispatch(request_type, request, **kwargs)
        # Only log "good" requests for now
        # We know once we're down here, that things are fine
        data = get_data(request_type, request, kwargs)
        track_event('request-%s' % request.META.get('REQUEST_METHOD', request_type), data)
        return response

class LoggingModelResource(ModelResource):
    def dispatch(self, request_type, request, **kwargs):
        # Let the "real" dispatch do its thing.
        # This includes checking a throttle, authentication, authorization, etc.
        response = super(LoggingModelResource, self).dispatch(request_type, request, **kwargs)
        # Only log "good" requests for now
        # We know once we're down here, that things are fine
        data = get_data(request_type, request, kwargs)
        track_event('request-%s' % request.META.get('REQUEST_METHOD', request_type), data)
        return response
开发者ID:Fogest,项目名称:guelphdev-api-service,代码行数:32,代码来源:resource.py

示例6: index

# 需要导入模块: from mixpanel.tasks import EventTracker [as 别名]
# 或者: from mixpanel.tasks.EventTracker import run [as 别名]
def index(request):
    et = EventTracker()
    et.run('dj_event', {'distinct_id': 1}, token=settings.token )
    return HttpResponse("Hello, world!.")
开发者ID:shamiksharma,项目名称:tutorials,代码行数:6,代码来源:views.py


注:本文中的mixpanel.tasks.EventTracker.run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。