當前位置: 首頁>>代碼示例>>Python>>正文


Python Mixpanel.send_events_batch方法代碼示例

本文整理匯總了Python中mixpanel.Mixpanel.send_events_batch方法的典型用法代碼示例。如果您正苦於以下問題:Python Mixpanel.send_events_batch方法的具體用法?Python Mixpanel.send_events_batch怎麽用?Python Mixpanel.send_events_batch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mixpanel.Mixpanel的用法示例。


在下文中一共展示了Mixpanel.send_events_batch方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_events_batch

# 需要導入模塊: from mixpanel import Mixpanel [as 別名]
# 或者: from mixpanel.Mixpanel import send_events_batch [as 別名]
 def test_events_batch(self):
     events_list = [
         {
             "event": "Signed Up",
             "properties": {
                 "distinct_id": "13793",
                  "token": "e3bc4100330c35722740fb8c6f5abddc",
                  "Referred By": "Friend",
                  "time": 1371002000
             }
         },
         {
             "event": "Uploaded Photo",
             "properties": {
                 "distinct_id": "13793",
                 "token": "e3bc4100330c35722740fb8c6f5abddc",
                 "Topic": "Vacation",
                 "time": 1371002104
             }
         }
     ]
     token = "e3bc4100330c35722740fb8c6f5abddc"
     mp = Mixpanel(token)
     mock_response = Mock()
     mock_response.read.return_value = '1'
     data = mp._prepare_data(events_list)
     with patch('urllib2.Request', return_value = mock_response) as mock_Request:
         with patch('urllib2.urlopen', return_value = mock_response) as mock_urlopen:
             mp.send_events_batch(events_list)
     mock_Request.assert_called_once_with(self.track_request_url, data)
開發者ID:daemonburrito,項目名稱:mixpanel-python,代碼行數:32,代碼來源:test.py


注:本文中的mixpanel.Mixpanel.send_events_batch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。