# Path: groupy/utils.py
# def urljoin(base, path=None):
# def parse_share_url(share_url):
# def get_rfc3339(when):
# def get_datetime(timestamp):
#     def __init__(self, key, value):
#     def __repr__(self):
#     def __call__(self, obj):
#     def __init__(self, tests):
#     def __call__(self, objects):
#     def find(self, objects):
#     def passes(self, obj):
# def make_filter(**tests):
# class AttrTest:
# class Filter:
# 
# Path: groupy/exceptions.py
# class GroupyError(Exception):
# class MissingMembershipError(GroupyError):
# class FindError(GroupyError):
# class NoMatchesError(FindError):
# class MultipleMatchesError(FindError):
# class ApiError(GroupyError):
# class NoResponse(ApiError):
# class BadResponse(ApiError):
# class InvalidJsonError(BadResponse):
# class MissingResponseError(BadResponse):
# class MissingMetaError(BadResponse):
# class ResultsError(ApiError):
# class ResultsNotReady(ResultsError):
# class ResultsExpired(ResultsError):
#     def __init__(self, message=None):
#     def __init__(self, group_id, user_id, message=None):
#     def __init__(self, message, objects, tests, matches=None):
#     def __init__(self, objects, tests):
#     def __init__(self, objects, tests, matches):
#     def __init__(self, request, *args, **kwargs):
#     def __init__(self, response, message=None):
#     def _extract_message(self, response):
#     def __init__(self, response, message='The JSON was incomplete/invalid'):
#     def __init__(self, response, message='The response contained no response data'):
#     def __init__(self, response, message='The response contained no meta data'):
#     def __init__(self, response, message):
#     def __init__(self, response, message='The results are not ready yet'):
#     def __init__(self, response, message='The results have expired'):


from collections import namedtuple
from . import base
from . import messages
from . import user
from groupy import utils
from groupy import exceptions
import time
import uuid
        Each given user must be a dictionary containing a nickname and either
        an email, phone number, or user_id.

        :param args users: the users to add
        :return: a membership request
        :rtype: :class:`MembershipRequest`
        """
        guid = uuid.uuid4()
        for i, user_ in enumerate(users):
            user_['guid'] = '{}-{}'.format(guid, i)

        payload = {'members': users}
        url = utils.urljoin(self.url, 'add')
        response = self.session.post(url, json=payload)
        return MembershipRequest(self, *users, group_id=self.group_id,
                                 **response.data)

    def check(self, results_id):
        """Check for results of a membership request.

        :param str results_id: the ID of a membership request
        :return: successfully created memberships
        :rtype: :class:`list`
        :raises groupy.exceptions.ResultsNotReady: if the results are not ready
        :raises groupy.exceptions.ResultsExpired: if the results have expired
        """
        path = 'results/{}'.format(results_id)
        url = utils.urljoin(self.url, path)
        response = self.session.get(url)
        if response.status_code == 503:

# Path: groupy/utils.py
# def urljoin(base, path=None):
# def parse_share_url(share_url):
# def get_rfc3339(when):
# def get_datetime(timestamp):
#     def __init__(self, key, value):
#     def __repr__(self):
#     def __call__(self, obj):
#     def __init__(self, tests):
#     def __call__(self, objects):
#     def find(self, objects):
#     def passes(self, obj):
# def make_filter(**tests):
# class AttrTest:
# class Filter:
# 
# Path: groupy/exceptions.py
# class GroupyError(Exception):
# class MissingMembershipError(GroupyError):
# class FindError(GroupyError):
# class NoMatchesError(FindError):
# class MultipleMatchesError(FindError):
# class ApiError(GroupyError):
# class NoResponse(ApiError):
# class BadResponse(ApiError):
# class InvalidJsonError(BadResponse):
# class MissingResponseError(BadResponse):
# class MissingMetaError(BadResponse):
# class ResultsError(ApiError):
# class ResultsNotReady(ResultsError):
# class ResultsExpired(ResultsError):
#     def __init__(self, message=None):
#     def __init__(self, group_id, user_id, message=None):
#     def __init__(self, message, objects, tests, matches=None):
#     def __init__(self, objects, tests):
#     def __init__(self, objects, tests, matches):
#     def __init__(self, request, *args, **kwargs):
#     def __init__(self, response, message=None):
#     def _extract_message(self, response):
#     def __init__(self, response, message='The JSON was incomplete/invalid'):
#     def __init__(self, response, message='The response contained no response data'):
#     def __init__(self, response, message='The response contained no meta data'):
#     def __init__(self, response, message):
#     def __init__(self, response, message='The results are not ready yet'):
#     def __init__(self, response, message='The results have expired'):


# Path: groupy/api/memberships.py
from collections import namedtuple
from . import base
from . import messages
from . import user
from groupy import utils
from groupy import exceptions
import time
import uuid

        Each given user must be a dictionary containing a nickname and either
        an email, phone number, or user_id.

        :param args users: the users to add
        :return: a membership request
        :rtype: :class:`MembershipRequest`
        """
        guid = uuid.uuid4()
        for i, user_ in enumerate(users):
            user_['guid'] = '{}-{}'.format(guid, i)

        payload = {'members': users}
        url = utils.urljoin(self.url, 'add')
        response = self.session.post(url, json=payload)
        return MembershipRequest(self, *users, group_id=self.group_id,
                                 **response.data)

    def check(self, results_id):
        """Check for results of a membership request.

        :param str results_id: the ID of a membership request
        :return: successfully created memberships
        :rtype: :class:`list`
        :raises groupy.exceptions.ResultsNotReady: if the results are not ready
        :raises groupy.exceptions.ResultsExpired: if the results have expired
        """
        path = 'results/{}'.format(results_id)
        url = utils.urljoin(self.url, path)
        response = self.session.get(url)
        if response.status_code == 503:

            raise exceptions.ResultsNotReady(response)