Initializing a DIS SDK Client Instance

You can use either of the following methods to initialize the DIS SDK client instance: For details about endpoint, ak, sk, region, and projectId, see Obtaining Authentication Information.

  • Use codes to initialize the DIS SDK client instance. For a code example, refer to all the files, except the __init__.py file, in the dis_sdk_python-X.X\dis_sdk_python\examples directory. The configuration parameters are as follows:
    1
    2
    3
    4
    5
    6
    //Create a DIS SDK client instance.
    projectid =" "       ID of the project for the DIS stream is used.
    endpoint=" "        Access address of DIS.
    ak = " "               AK created by the user on IAM.
    sk = " "               SK created by the user on IAM.
    region = " "         Area where the stream used by a user is located.
    
  • Use the configuration file to initialize the DIS SDK client instance.

    Set the configuration file information in the initialization_dis_sdk.py file under the dis_sdk_python-X.X\dis_sdk_python\ directory.

    1
    2
    3
    4
    5
    conf.set('Section1', 'projectid', '** your projectid **')
    conf.set('Section1', 'ak', '*** Provide your Access Key ***')
    conf.set('Section1', 'sk', '*** Provide your Secret Key ***')
    conf.set('Section1', 'region', '** region **')
    conf.set('Section1', 'endpoint', '** {ip}:{port} ***')
    

    After configuring the preceding parameters, run initialization_dis_sdk.py to generate the conf.ini file and obtain the dis_sdk_python\conf.ini configuration file.