VingtCinq / python-mailchimp

Python client for v3 of MailChimp API
MIT License
463 stars 131 forks source link

Error when Updating Campaign Content #129

Open rachaellynn opened 7 years ago

rachaellynn commented 7 years ago

I've been running this script for a few months now, off and on, and just started getting this error when updating campaign content with a template id. The campaign and the template do exist. Please advise! Thanks.

client.campaigns.content.update(campaign_id=campaign_id, data={'template':{'id':template_id}}) #170519 having trouble with this one
  File "/Users/rachael/anaconda2/lib/python2.7/site-packages/mailchimp3/entities/campaigncontent.py", line 51, in update
    return self._mc_client._put(url=self._build_path(campaign_id, 'content'), data=data)
  File "/Users/rachael/anaconda2/lib/python2.7/site-packages/mailchimp3/mailchimpclient.py", line 25, in wrapper
    return fn(self, *args, **kwargs)
  File "/Users/rachael/anaconda2/lib/python2.7/site-packages/mailchimp3/mailchimpclient.py", line 158, in _put
    r.raise_for_status()
  File "/Users/rachael/anaconda2/lib/python2.7/site-packages/requests/models.py", line 844, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://us15.api.mailchimp.com/3.0/campaigns/f457493110/content
stephenross commented 7 years ago

Sorry for the long delay, are you able to get the campaign itself using the id in the campaigns.get() method, and are you able to get the template with templates.get()? I see that you are obviously providing a value for the campaign_id, could you provide the context around that line on where you are getting the template_id that is being used?