Add uuid to identify products

This commit is contained in:
PCoder 2019-09-14 12:48:19 +05:30
parent 15911872f3
commit 73a7d9dc8b

View file

@ -9,6 +9,7 @@ from pyotp import TOTP
from config import etcd_client as client, logging, APP_PORT from config import etcd_client as client, logging, APP_PORT
from stripe_utils import StripeUtils from stripe_utils import StripeUtils
from uuid import uuid4
app = Flask(__name__) app = Flask(__name__)
api = Api(app) api = Api(app)
@ -59,7 +60,8 @@ class AddProduct(Resource):
return {"message": "Wrong Credentials"}, 403 return {"message": "Wrong Credentials"}, 403
try: try:
product_key = "/v1/products/" product_uuid = uuid4().hex
product_key = "/v1/products/{}".format(product_uuid)
product_value = { product_value = {
"name": data["product_name"], "name": data["product_name"],
"description": data["product_description"], "description": data["product_description"],