i'm a bit new in python and working on an API. I'd like to return a URI which accepts my 2 paramaters,which are input (target_group_id, date), this is my base url
get_customer_action_by_target_group_url = \
'https://api4.optimove.net/current/customers/GetCustomerActionsByTargetGroup?targetGroupID=&date='
and this is my function.
def get_customer_action_by_target_group(self):
payload = {"TargetGroupID": "%s" % self.TargetGroupID, "Date":"%s" % self.date,
}
if not self.TargetGroupID or not self.date:
get_target_group_id = (raw_input("Please provide the target Group id:"))
get_date = (raw_input("Please provide the date as required:"))
self.TargetGroupID = get_target_group_id
self.date = get_date
response = self.send_request(self.get_customer_action_by_target_group_url + self.TargetGroupID +
self.date,
json.dumps(payload), "GET")
print response, response.text, response.reason
return response
This should pass the paramters in my url which needs to look like this: https://api4.optimove.net/current/customers/GetCustomerActionsByTargetGroup?targetGroupID=19&date=20 july 2017 After passing the date and the target groupe_id , but i'm getting this rather https://api4.optimove.net/current/customers/GetCustomerActionsByTargetGroup?targetGroupID=%25s&date=%25s7220%20July%202017. How could i fixe this ? any sample of code which could help?? Thank you