Ok, I’m working on the new mashape’s python client library, according to the next big release
Task:
clear an url with placeholder like this one:
http://mashape.com/url?param1=p¶m2={value1}¶m3={value2}
if “value1” is not in the provided array of parameters, the url should become
http://mashape.com/url?param1=p¶m3={value2}
(later in the process, this placeholders will be substituted with the actual data)
Code:
keys = re.findall(’{([a-zA-Z0-9-_]*)}’, url)
for key in keys:
if key not in parameters:
re.sub(“[^&?]*={”+key+“}&?”, “”, url)
Hail to the regexp, baby