Skip to main content

URL Parsing

Below is the example where in the current context, we are receiving a Url in the 'name' key with a value like '{{base_url}}abc/xyz/pqr,' but we need the Url to be in the format '{{base_url}}abc%xyz%pqr.' To achieve this, we will utilize the following Python code

from urllib.parse import quote
Responsedata = []
keyname_1 = ["name"]
for i in keyname_1:
   name= pycode_data.pop(i, None)
   encoded_object_name = quote(name, safe="")
   pycode_data["name"]=encoded_object_name