VingtCinq / python-mailchimp

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

No longer rising 404 Resource Not Found on deleted emails #201

Closed bdabrowski closed 4 years ago

bdabrowski commented 5 years ago

I was wondering if someone could release their email in a system so someone else may use it later with mailchimp integration.

The test below was passing successfully in April.

    def test_make_user_can_be_recreated(self):
        """
        Make sure user with the same email address can be created, deleted and then created again.
        """
        username = str(uuid.uuid4())
        response = self.client.lists.members.create(
            self.list_id,
            data={
                'email_address': username + '@mydomain.com',
                'status': 'subscribed',
                'merge_fields': {
                    'FNAME': 'John',
                    'LNAME': 'Doe',
                },
            })
        self.assertEqual(response['status'], 'subscribed')
        response = self.client.lists.members.delete(
            list_id=self.list_id,
            subscriber_hash=get_subscriber_hash(username + '@mydomain.com'))
        try:
            response = self.client.lists.members.get(
                list_id=self.list_id,
                subscriber_hash=get_subscriber_hash(username + '@mydomain.com'))
        except MailChimpError as error:
            self.assertEqual(error.args[0]['title'], 'Resource Not Found')
            self.assertEqual(error.args[0]['status'], 404)
        else:
            print(response)
            self.assertTrue(False)

Now it's not passing anymore. Is it possible there were Mailchimp API changes that reflects it?

Now the respnse status is just empty string instead of error. Tested with: 3.0.7 and 3.0.6

janzenz commented 5 years ago

Since you are reusing response which part of the request responds with an empty string?

stephenross commented 4 years ago

I believe that the delete action no longer does anything in MailChimp. I attempted to use it for a project earlier and it appears that it is not possible to programatically archive people from lists in that manner any longer. This may be MailChimp cracking down on diverting people from MailChimp's unsubscribe to their own and preventing that entirely or it may be something else. Looking at the interface when logged in as an admin account, you can perform the same action by selecting a member on your list, using the actions dropdown, selecting remove from list, and using the archive option. The delete permanently option shown in that interface is the delete permanently action in the list member endpoints.