本文整理汇总了Python中shotgun_api3.Shotgun.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Shotgun.__init__方法的具体用法?Python Shotgun.__init__怎么用?Python Shotgun.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shotgun_api3.Shotgun
的用法示例。
在下文中一共展示了Shotgun.__init__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import __init__ [as 别名]
def __init__(self, base_url, script_name, api_key, convert_datetimes_to_utc=True,
http_proxy=None, ensure_ascii=True, connect=True, host=None, port=None):
'''
We will initialize the Shotgun object, but will not connect right away.
Instead it will will attempt to create a socket connection using the
Shotgun object and the host and port data provided or generated. If we do
not have a host and port specified, or do not find a connection, we will
fall back and connect to the actual Shotgun server instead.
'''
Shotgun.__init__(self, base_url, script_name, api_key,
convert_datetimes_to_utc=convert_datetimes_to_utc,
http_proxy=http_proxy, ensure_ascii=ensure_ascii,
connect=False)
# If a host is not specified, attempt using the local machine.
if not host:
host = socket.gethostname()
# If a port is not specified, generate a port from the app key.
if not port:
port = common.appKeyToPort(self.config.api_key)
self._sgclient = None
self._host = host
self._port = port
if connect:
self.connect()