From 97743f1346c8097277ad483b408e60a91f1aa0d0 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sat, 14 Sep 2019 13:50:00 +0530 Subject: [PATCH] Use get instead of get_prefix to obtain the desired product --- ucloud-pay.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ucloud-pay.py b/ucloud-pay.py index 2b8e33d..cf7011d 100644 --- a/ucloud-pay.py +++ b/ucloud-pay.py @@ -227,14 +227,14 @@ class ProductOrder(Resource): # Validate the given product is ok product_id = data["product_id"] - product = client.get_prefix( - "/v1/products/{}/".format(product_id), value_in_json=True + product = client.get( + "/v1/products/{}".format(product_id), value_in_json=True ) if not product: - logging.debug("User chose invalid product {}".format(product)) + logging.debug("User chose invalid product {}".format(product_id)) return {"message": "Invalid product"}, 400 - logging.debug("Got product {}".format(str(product))) + logging.debug("Got product {}: {}".format(product.key, product.value)) # Check the user has a payment source added