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


Python Shotgun.batch方法代码示例

本文整理汇总了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)
    
    
开发者ID:ProjectGuerilla,项目名称:Shotgun-Code-Snippets,代码行数:30,代码来源:sg_skype_button_adder.py


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