本文整理汇总了Python中shotgun_api3.Shotgun.batch方法的典型用法代码示例。如果您正苦于以下问题:Python Shotgun.batch方法的具体用法?Python Shotgun.batch怎么用?Python Shotgun.batch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shotgun_api3.Shotgun
的用法示例。
在下文中一共展示了Shotgun.batch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: shotgun
# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import batch [as 别名]
#find all the users that have skype-id's
users= sg.find("HumanUser",filters,fields)
#initialize an empty list to contain shotgun update requests
batch_data = []
#process all users checking to see if button data is correct for the user name
# (this is in case a skype user name changes) or if there is not a button
for user in users:
# put skype user name into template to create button html code
skype_button_text = button_template.safe_substitute(skype_id=user[SKYPE_ID_FIELD])
skype_contact_text = contact_template.safe_substitute(skype_id=user[SKYPE_ID_FIELD])
if user[SKYPE_BUTTON_FIELD] <> skype_button_text:
#set the skype button html into the user container
user[SKYPE_BUTTON_FIELD] = skype_button_text
user[SKYPE_ADD_CONTACT_FIELD] = skype_contact_text
#remove extraneous data from user so that it can put into an update request
user_id = user.pop('id')
dummy = user.pop('type')
#append the update to the batch list
batch_data.append( {'request_type':'update' , 'entity_type':'HumanUser' , 'entity_id': user_id , 'data':user})
# when done, process the updates to the users with a single call to shotgun (if necessary)
if batch_data:
sg.batch(batch_data)