I am making an api call and in doing so I have to manually change the endDate in the payload every day. I can not use .format() inside a dictionary. Can anyone help out?
Current payload: where I am changing the endDate manually
payload = "{\"dimensions\":[\"AdsetId\",\"Adset\",\"CampaignId\",\"Campaign\",\"Device\",\"Day\",\"Month\",\"Year\",\"Week\",\"Os\"],\"metrics\":[\"AdvertiserCost\",\"Displays\",\"ClickThroughRate\",\"Cpc\",\"AppInstalls\",\"Clicks\"],\"timezone\":\"UTC\",\"advertiserIds\":\"69957\",\"currency\":\"USD\",\"startDate\":\"2022-01-01T00:00:00.0000000+00:00\",\"***endDate\":\"2022-01-13***T00:00:00.0000000+00:00\",\"format\":\"csv\"}"
Expected payload:
payload = "{\"dimensions\":[\"AdsetId\",\"Adset\",\"CampaignId\",\"Campaign\",\"Device\",\"Day\",\"Month\",\"Year\",\"Week\",\"Os\"],\"metrics\":[\"AdvertiserCost\",\"Displays\",\"ClickThroughRate\",\"Cpc\",\"AppInstalls\",\"Clicks\"],\"timezone\":\"UTC\",\"advertiserIds\":\"69957\",\"currency\":\"USD\",\"startDate\":\"2022-01-01T00:00:00.0000000+00:00\",\endDate\":\"{}T00:00:00.0000000+00:00\",\"format\":\"csv\"}".format(today)
Here today will be a variable with today’s date