This document provides instructions for using the Flink SDK. To view all API details, see the API documentation. Use API Explorer to quickly make API calls, get responses, and view code examples.
https://pypi.org/project/volcengine-python-sdk/1.1.3/
https://github.com/volcengine/volcengine-python-sdk/tree/master/volcenginesdkflink20250101
Python 2.7 or later.
Note
Installation may fail due to the maximum path length limit in Windows. Configure your settings as follows:
Step 1: integrate the service repository
Install via pip:
pip install volcengine-python-sdk
Install via Setuptools:
python setup.py install --user
Or sudo python setup.py install to install dependencies for all users.
Step 2: initialize on startup and configure the global default parameters for Configuration
configuration = volcenginesdkcore.Configuration() configuration.client_side_validation = True # Whether the client performs parameter validation configuration.schema = "http" # https or http configuration.debug = False # Whether to enable debugging configuration.logger_file = "sdk.log" volcenginesdkcore.Configuration.set_default(configuration)
Step 3: get the Client
def get_client(ak, sk, region): # Include default properties configuration = volcenginesdkcore.Configuration() configuration.ak = ak # Leaking the AK is risky. It is recommended to retrieve it from a configuration file. configuration.sk = sk # SK leakage is a security risk. We recommend obtaining the SK from a configuration file. configuration.region = region client = volcenginesdkautoscaling.AUTOSCALINGApi(volcenginesdkcore.ApiClient(configuration)) return client
If you want to customize the SDK's Endpoint, you can configure it with the following code example:
configuration = volcenginesdkcore.Configuration() configuration.host = 'ecs.cn-beijing-autodriving.volcengineapi.com'
Volcengine standard Endpoint rules:
Regional Service | Global Service |
|---|---|
|
|
Note: Convert underscores (_) in the Service name to hyphens (-) for the Endpoint. Convert uppercase letters to lowercase.
The following is an SDK code sample for calling the GetApplicationInstance API. You can replace it with any other API supported by the SDK in your project.
# Example Code generated by Beijing Volcanoengine Technology. from __future__ import print_function import volcenginesdkcore import volcenginesdkflink20250101 from pprint import pprint from volcenginesdkcore.rest import ApiException if __name__ == '__main__': configuration = volcenginesdkcore.Configuration() configuration.ak = "Your AK" configuration.sk = "Your SK" configuration.region = "cn-beijing" # set default configuration volcenginesdkcore.Configuration.set_default(configuration) # use global default configuration api_instance = volcenginesdkflink20250101.FLINK20250101Api() get_application_instance_request = volcenginesdkflink20250101.GetApplicationInstanceRequest( ) try: resp = api_instance.get_application_instance(get_application_instance_request) pprint(resp) except ApiException as e: print("Exception when calling api: %s\n" % e)