New feature: can set max retry times for API request.     Default is 0.