create_api_session#

create_api_session(device_serial: str, api_level: int, server_host: Optional[str] = None, server_port: int = 8004, *, required_devtype: Optional[str] = None, required_options: Optional[str] = None, required_err_msg: Optional[str] = None) Tuple[ziDAQServer, str, Dict][source]#

Create an API session for the specified device.

Parameters:
  • device_serial (str) – A string specifying the device serial number. For example, ‘uhf-dev2123’ or ‘dev2123’.

  • api_level (int) – The targeted API level used by the code where the returned API session will be used. The maximum API level you may use is defined by the device class. HF2 only supports API level 1 and other devices support API level 6. You should try to use the maximum level possible to enable extended API features.

  • server_host (Optional[str]) – A hostname or IP address. The data server can be omitted if the targeted device is an MF* device or a local data server is running. In this case it will try to connect to the local data server or device internal data server (local server has priority).

  • server_port (int) – The port number of the data server. The default port is 8004.

  • required_devtype (Optional[str]) – Deprecated: This option will be ignored.

  • required_options (Optional[str]) – Deprecated: This option will be ignored.

  • required_err_msg (Optional[str]) – Deprecated: This option will be ignored.

Returns:

An instance of the ziPython.ziDAQServer class

(representing an API session connected to a Data Server).

device: The device’s ID, this is the string that specifies the

device’s node branch in the data server’s node tree.

props: The device’s discovery properties as returned by the

ziDiscovery get() method.

Return type:

daq