本文整理匯總了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()