本文整理汇总了Python中mixpanel.Mixpanel.people_set方法的典型用法代码示例。如果您正苦于以下问题:Python Mixpanel.people_set方法的具体用法?Python Mixpanel.people_set怎么用?Python Mixpanel.people_set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mixpanel.Mixpanel
的用法示例。
在下文中一共展示了Mixpanel.people_set方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: users
# 需要导入模块: from mixpanel import Mixpanel [as 别名]
# 或者: from mixpanel.Mixpanel import people_set [as 别名]
def users(email, name=None, ip=None):
mp = Mixpanel(TOKEN)
params = {'$email': email}
if name:
params['$name'] = name
if ip:
params['$ip'] = ip
mp.people_set(email, params)
示例2: test_people_set
# 需要导入模块: from mixpanel import Mixpanel [as 别名]
# 或者: from mixpanel.Mixpanel import people_set [as 别名]
def test_people_set(self):
token = '12345'
mp = Mixpanel(token)
mock_response = Mock()
mock_response.read.return_value = '1'
with patch('urllib2.urlopen', return_value = mock_response) as mock_urlopen:
mp.people_set('amq', {'birth month': 'october', 'favorite color': 'purple'})
data = mp._prepare_data({'$token': '12345', '$distinct_id': 'amq', '$set': {'birth month': 'october', 'favorite color': 'purple'}})
mock_urlopen.assert_called_once_with(self.engage_request_url, data)
示例3: mixpanel_people_set
# 需要导入模块: from mixpanel import Mixpanel [as 别名]
# 或者: from mixpanel.Mixpanel import people_set [as 别名]
def mixpanel_people_set(distinct_id, event_name, value=None, increment=False):
"""
If value not set value = datetime`
"""
if not distinct_id:
return
if not settings.DEBUG and domain_exclude and distinct_id.endswith(domain_exclude):
return
id = settings.METRICS.get('mixpanel', {}).get('id')
if not id:
logger.info('Mixpanel id not defined, task ignored')
return
mp = Mixpanel(id)
if increment:
mp.people_increment(distinct_id, {event_name: value})
else:
if value is None:
value = datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')
mp.people_set(distinct_id, {event_name: value})
示例4: str
# 需要导入模块: from mixpanel import Mixpanel [as 别名]
# 或者: from mixpanel.Mixpanel import people_set [as 别名]
name = row[0]
name1 = name.split()
name1 = "".join(name1)
username = name1 + str(random.randint(1, 1000)) + \
random.choice(string.letters)
phone_no = row[1]
email = row[2]
phone_type = row[5]
android_version = row[6]
if len(phone_no) == 10:
if phone_no[:1] == '9':
phone_no = '+977' + phone_no
mp.people_set(username, {
'$phone': phone_no,
'$name': name,
'$email': email,
'phone_type': phone_type,
'android_version': android_version
})
f.close()
f = open('feedback2.csv', 'rb')
reader = csv.reader(f)
for row in list(reader)[1:]:
name = row[0]
name1 = name.split()
name1 = "".join(name1)
username = name1 + str(random.randint(1, 1000)) + \
random.choice(string.letters)
示例5: Mixpanel
# 需要导入模块: from mixpanel import Mixpanel [as 别名]
# 或者: from mixpanel.Mixpanel import people_set [as 别名]
from mixpanel import Mixpanel
from twilio.rest import TwilioRestClient
import mixpanel
# import datetime
mp = Mixpanel(ae91c3869706778b25a08e6f504ab1bd)
# create or update a profile with First Name, Last Name,
# E-Mail Address, Phone Number, and Favorite Color
mp.people_set('johndoe', {
'$first_name' : 'John',
'$last_name' : 'Doe',
'$email' : '[email protected]',
'$phone' : '5555555555',
'Company' : 'Mylo Real Estate',
'RERA' : '49231',
'Subscription Plan' : 'Free'
})
mp.people_append('johndoe', {
'Last Logged in' : 'Today'
})
# You can also include properties to describe
# the circumstances of the event
mp.track(johndoe, 'Subscription Plan', {
'Old Plan': 'Free',
'New Plan': 'Enterprise'
})
# Your Account Sid and Auth Token from twilio.com/user/account