本文整理汇总了Python中pyeloqua.Bulk.sync方法的典型用法代码示例。如果您正苦于以下问题:Python Bulk.sync方法的具体用法?Python Bulk.sync怎么用?Python Bulk.sync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyeloqua.Bulk
的用法示例。
在下文中一共展示了Bulk.sync方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_run_sync_timeout
# 需要导入模块: from pyeloqua import Bulk [as 别名]
# 或者: from pyeloqua.Bulk import sync [as 别名]
def test_run_sync_timeout(mock_get, mock_post):
""" fcn to run a sync end-to-end until finished - timeout """
bulk = Bulk(test=True)
bulk.exports('contacts')
bulk.job_def = EXPORT_JOB_DEF
mock_post.return_value = Mock(ok=True, status_code=200)
mock_post.return_value.json.return_value = deepcopy(SYNC_RESPONSE)
mock_get.return_value = Mock(ok=True, status_code=200)
mock_get.return_value.json.return_value = SYNC_RESPONSE_ACTIVE
bulk.sync(sleeptime=0.03, timeout=0.01)
示例2: test_run_sync_error
# 需要导入模块: from pyeloqua import Bulk [as 别名]
# 或者: from pyeloqua.Bulk import sync [as 别名]
def test_run_sync_error(mock_get, mock_post):
""" fcn to run a sync end-to-end until finished - error """
bulk = Bulk(test=True)
bulk.exports('contacts')
bulk.job_def = EXPORT_JOB_DEF
mock_post.return_value = Mock(ok=True, status_code=200)
mock_post.return_value.json.return_value = deepcopy(SYNC_RESPONSE)
mock_get.return_value = Mock(ok=True, status_code=200)
mock_get.return_value.json.return_value = SYNC_RESPONSE_ERROR
status = bulk.sync(sleeptime=0.01)
assert status == 'error'
示例3: segment
# 需要导入模块: from pyeloqua import Bulk [as 别名]
# 或者: from pyeloqua.Bulk import sync [as 别名]
# we could get the same set of fields like this:
field_set = ['Email Address', 'contactID', 'createdAt', 'First Name',
'isSubscribed', 'isBounced']
# Now add them to our job
bulk.add_fields(field_set)
# Add a filter which will only give us contacts in our segment (using the ID from the segment URL)
bulk.asset_exists('segments', asset_id=12345)
# we could also get it like this, assuming the segment name is 'My Segment':
bulk.asset_exists('segments', name='My Segment')
# Now we're ready to export the data
bulk.create_def('my export')
bulk.sync() # creates a sync which tells Eloqua to prepare the data
contact_records = bulk.get_export_data() # retrieve the prepared data
# Let's take a look at our data:
for contact in contact_records:
print(contact)