When using the Alibaba Cloud Python SDK to call APIs, the service endpoint for each API is required.

Configuration method

You only need to specify a region ID when you initialize an AcsClient object. The corresponding endpoint is returned based on the specified region ID and service name.
Note You cannot change the sequence of the parameters. Enter AccessKey ID, then AccessKey Secret, and finally Region ID.
client = AcsClient(
    "<your-access-key-id>",
    "<your-access-key-secret>",
    "<your-region-id>"   # Note the sequence of the parameters. The third parameter is Region ID.
);

Troubleshooting

If the error SDK.InvalidRegionId or Can not find endpoint to access occurs when you use the Alibaba Cloud SDK for Python, you can troubleshoot the error as follows:

  • Cause 1: The service is not available in the specified region, or the service is available in the specified region but does not have an endpoint.

    Solution: Submit a ticket to apply for an endpoint.

  • Cause 2: The parameters are incorrect.

    Solution: Ensure that all parameter values and the sequence of the parameters are correct.