Help Center> Enterprise Management> User Guide> Project Management> FAQs> How Do I Do If I Cannot Obtain Enterprise Projects Using the EPS Java or Python SDK?
Updated on 2023-06-26 GMT+08:00

How Do I Do If I Cannot Obtain Enterprise Projects Using the EPS Java or Python SDK?

If you cannot obtain enterprise projects using the EPS Java or Python SDK, perform the following operations:

  1. Check whether the token is obtained in DomainToken mode. EPS is a global service. Therefore, DomainToken is required.
  2. If you use the SDK in AK/SK authentication mode, check whether the authentication mode is domain-level. When the AK/SK is transferred to API Gateway, API Gateway converts the AK/SK into a response token, which is used to invoke EPS.
  3. Check whether the domain name of the HTTP API for requesting EPS is correct. You can view the domain name in the detailed logs. Set the log displaying statement before calling the API.

    • To print logs in Java, run the following statement:

    OSFactory.enableHttpLoggingFilter(true);

    • To print logs in Python, run the following statement:

    utils.enable_logging(debug=True,stream=sys.stdout)

  4. The public cloud domain name of EPS is unique. The endpoint is https://eps.myhuaweicloud.com/v1.0.

    If the domain name of the HTTP interface for requesting EPS is incorrect, perform the following operations to set the correct EPS endpoint:

    • In Java, most code is displayed in the SDK Demo and you only need to pay attention to the following comments:

    // Generate an endpoint parser.

    OverridableEndpointURLResolver endpointResolver = new OverridableEndpointURLResolver();

    endpointResolver.addOverrideEndpoint(ServiceType.EPS, "https://eps.myhuaweicloud.com/v1.0");

    String user = "xxxxx";

    String password = "******";

    String userDomainId = "yyyyyyyyyyy";

    String authUrl = "https://iam.xxxx.com/v3";

    // Configure log display.

    OSFactory.enableHttpLoggingFilter(true);

    // Generate the config object.

    Config config = Config.newConfig().withEndpointURLResolver(endpointResolver);

    // Request the client to use the config object.

    OSClient.OSClientV3 osclient = OSFactory.builderV3().endpoint(authUrl).withConfig(config)

    .credentials(user, password, Identifier.byId(userDomainId)).scopeToDomain(Identifier.byId(userDomainId)).authenticate();

    • Python:

    os.environ.setdefault('OS_EPS_ENDPOINT_OVERRIDE', 'https://eps.myhuaweicloud.com/v1.0')

  5. If a 500 error is reported when the API is called, contact customer service.

    The SDK of an earlier version is complex to use. You are advised to use the Union SDK of the latest version.