How to use the mailchimp3.helpers.check_subscriber_hash function in mailchimp3

To help you get started, we’ve selected a few mailchimp3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github VingtCinq / python-mailchimp / mailchimp3 / entities / listsegmentmembers.py View on Github external
def delete(self, list_id, segment_id, subscriber_hash):
        """
        Remove a member from the specified static segment.

        :param list_id: The unique id for the list.
        :type list_id: :py:class:`str`
        :param segment_id: The unique id for the segment.
        :type segment_id: :py:class:`str`
        :param subscriber_hash: The MD5 hash of the lowercase version of the
          list member’s email address.
        :type subscriber_hash: :py:class:`str`
        """
        subscriber_hash = check_subscriber_hash(subscriber_hash)
        self.list_id = list_id
        self.segment_id = segment_id
        self.subscriber_hash = subscriber_hash
        return self._mc_client._delete(
            url=self._build_path(list_id, 'segments', segment_id, 'members', subscriber_hash)
        )
github VingtCinq / python-mailchimp / mailchimp3 / entities / listmembernotes.py View on Github external
Get recent notes for a specific list member.

        :param list_id: The unique id for the list.
        :type list_id: :py:class:`str`
        :param subscriber_hash: The MD5 hash of the lowercase version of the
          list member’s email address.
        :type subscriber_hash: :py:class:`str`
        :param get_all: Should the query get all results
        :type get_all: :py:class:`bool`
        :param queryparams: The query string parameters
        queryparams['fields'] = []
        queryparams['exclude_fields'] = []
        queryparams['count'] = integer
        queryparams['offset'] = integer
        """
        subscriber_hash = check_subscriber_hash(subscriber_hash)
        self.list_id = list_id
        self.subscriber_hash = subscriber_hash
        self.note_id = None
        if get_all:
            return self._iterate(url=self._build_path(list_id, 'members', subscriber_hash, 'notes'), **queryparams)
        else:
            return self._mc_client._get(url=self._build_path(list_id, 'members', subscriber_hash, 'notes'), **queryparams)
github VingtCinq / python-mailchimp / mailchimp3 / entities / listmembers.py View on Github external
def delete(self, list_id, subscriber_hash):
        """
        Delete a member from a list.

        :param list_id: The unique id for the list.
        :type list_id: :py:class:`str`
        :param subscriber_hash: The MD5 hash of the lowercase version of the
          list member’s email address.
        :type subscriber_hash: :py:class:`str`
        """
        subscriber_hash = check_subscriber_hash(subscriber_hash)
        self.list_id = list_id
        self.subscriber_hash = subscriber_hash
        return self._mc_client._delete(url=self._build_path(list_id, 'members', subscriber_hash))
github VingtCinq / python-mailchimp / mailchimp3 / entities / listmembernotes.py View on Github external
description of the method.

        :param list_id: The unique id for the list.
        :type list_id: :py:class:`str`
        :param subscriber_hash: The MD5 hash of the lowercase version of the
          list member’s email address.
        :type subscriber_hash: :py:class:`str`
        :param note_id: The id for the note.
        :type note_id: :py:class:`str`
        :param data: The request body parameters
        :type data: :py:class:`dict`
        data = {
            "note": string*
        }
        """
        subscriber_hash = check_subscriber_hash(subscriber_hash)
        self.list_id = list_id
        self.subscriber_hash = subscriber_hash
        self.note_id = note_id
        if 'note' not in data:
            raise KeyError('The list member note must have a note')
        return self._mc_client._patch(
            url=self._build_path(list_id, 'members', subscriber_hash, 'notes', note_id),
            data=data
        )
github VingtCinq / python-mailchimp / mailchimp3 / entities / reportemailactivity.py View on Github external
def get(self, campaign_id, subscriber_hash, **queryparams):
        """
        Get a specific list member’s activity in a campaign including opens,
        clicks, and bounces.

        :param campaign_id: The unique id for the campaign.
        :type campaign_id: :py:class:`str`
        :param subscriber_hash: The MD5 hash of the lowercase version of the
          list member’s email address.
        :type subscriber_hash: :py:class:`str`
        :param queryparams: The query string parameters
        queryparams['fields'] = []
        queryparams['exclude_fields'] = []
        """
        subscriber_hash = check_subscriber_hash(subscriber_hash)
        self.campaign_id = campaign_id
        self.subscriber_hash = subscriber_hash
        return self._mc_client._get(
            url=self._build_path(campaign_id, 'email-activity', subscriber_hash),
            **queryparams
        )
github VingtCinq / python-mailchimp / mailchimp3 / entities / listmembertags.py View on Github external
def all(self, list_id, subscriber_hash, **queryparams):
        """
        Get all tags for a specific list member.

        :param list_id: The unique id for the list.
        :type list_id: :py:class:`str`
        :param subscriber_hash: The MD5 hash of the lowercase version of the
          list member’s email address.
        :type subscriber_hash: :py:class:`str`
        """
        subscriber_hash = check_subscriber_hash(subscriber_hash)
        self.list_id = list_id
        self.subscriber_hash = subscriber_hash
        return self._mc_client._get(url=self._build_path(list_id, 'members', subscriber_hash, 'tags'), **queryparams)
github VingtCinq / python-mailchimp / mailchimp3 / entities / reportunsubscribes.py View on Github external
def get(self, campaign_id, subscriber_hash, **queryparams):
        """
        Get information about a specific list member who unsubscribed from a
        campaign.

        :param campaign_id: The unique id for the campaign.
        :type campaign_id: :py:class:`str`
        :param subscriber_hash: The MD5 hash of the lowercase version of the
          list member’s email address.
        :type subscriber_hash: :py:class:`str`
        :param queryparams: The query string parameters
        queryparams['fields'] = []
        queryparams['exclude_fields'] = []
        """
        subscriber_hash = check_subscriber_hash(subscriber_hash)
        self.campaign_id = campaign_id
        self.subscriber_hash = subscriber_hash
        return self._mc_client._get(url=self._build_path(campaign_id, 'unsubscribed', subscriber_hash), **queryparams)
github VingtCinq / python-mailchimp / mailchimp3 / entities / reportclickdetailmembers.py View on Github external
"""
        Get information about a specific subscriber who clicked a link in a
        specific campaign.

        :param campaign_id: The unique id for the campaign.
        :type campaign_id: :py:class:`str`
        :param link_id: The id for the link.
        :type link_id: :py:class:`str`
        :param subscriber_hash: The MD5 hash of the lowercase version of the
          list member’s email address.
        :type subscriber_hash: :py:class:`str`
        :param queryparams: The query string parameters
        queryparams['fields'] = []
        queryparams['exclude_fields'] = []
        """
        subscriber_hash = check_subscriber_hash(subscriber_hash)
        self.campaign_id = campaign_id
        self.link_id = link_id
        self.subscriber_hash = subscriber_hash
        return self._mc_client._get(
            url=self._build_path(campaign_id, 'click-details', link_id, 'members', subscriber_hash),
            **queryparams
        )
github VingtCinq / python-mailchimp / mailchimp3 / entities / listmembers.py View on Github external
Add or update a list member.

        :param list_id: The unique id for the list.
        :type list_id: :py:class:`str`
        :param subscriber_hash: The MD5 hash of the lowercase version of the
            list member’s email address.
        :type subscriber_hash: :py:class:`str`
        :param data: The request body parameters
        :type data: :py:class:`dict`
        data = {
            "email_address": string*,
            "status_if_new": string* (Must be one of 'subscribed',
                'unsubscribed', 'cleaned', 'pending', or 'transactional')
        }
        """
        subscriber_hash = check_subscriber_hash(subscriber_hash)
        self.list_id = list_id
        self.subscriber_hash = subscriber_hash
        if 'email_address' not in data:
            raise KeyError('The list member must have an email_address')
        check_email(data['email_address'])
        if 'status_if_new' not in data:
            raise KeyError('The list member must have a status_if_new')
        if data['status_if_new'] not in ['subscribed', 'unsubscribed', 'cleaned', 'pending', 'transactional']:
            raise ValueError('The list member status_if_new must be one of "subscribed", "unsubscribed", "cleaned", '
                             '"pending", or "transactional"')
        return self._mc_client._put(url=self._build_path(list_id, 'members', subscriber_hash), data=data)
github VingtCinq / python-mailchimp / mailchimp3 / entities / listmembernotes.py View on Github external
def delete(self, list_id, subscriber_hash, note_id):
        """
        Delete a specific note for a specific list member.

        :param list_id: The unique id for the list.
        :type list_id: :py:class:`str`
        :param subscriber_hash: The MD5 hash of the lowercase version of the
          list member’s email address.
        :type subscriber_hash: :py:class:`str`
        :param note_id: The id for the note.
        :type note_id: :py:class:`str`
        """
        subscriber_hash = check_subscriber_hash(subscriber_hash)
        self.list_id = list_id
        self.subscriber_hash = subscriber_hash
        self.note_id = note_id
        return self._mc_client._delete(url=self._build_path(list_id, 'members', subscriber_hash, 'notes', note_id))