# Path: zenpy/lib/exception.py
# class ZenpyException(Exception):
#     """
#     A ``ZenpyException`` is raised for internal errors.
#     """
# 
# Path: zenpy/lib/util.py
# def is_iterable_but_not_string(obj):
#     """
#     Determine whether or not obj is iterable but not a string (eg, a list, set, tuple etc).
#     """
#     return hasattr(obj, '__iter__') and not isinstance(
#         obj, str) and not isinstance(obj, bytes)
# 
# def to_unix_ts(start_time):
#     """Given a datetime object, returns its value as a unix timestamp"""
#     if isinstance(start_time, datetime):
#         if is_timezone_aware(start_time):
#             start_time = start_time.astimezone(pytz.utc)
#         else:
#             log.warning(
#                 "Non timezone-aware datetime object passed to IncrementalEndpoint. "
#                 "The Zendesk API expects UTC time, if this is not the case results will be incorrect!"
#             )
#         unix_time = calendar.timegm(start_time.timetuple())
#     else:
#         unix_time = start_time
# 
#     return int(unix_time)


import logging
from datetime import date
from datetime import datetime
from requests.utils import quote
from zenpy.lib.exception import ZenpyException
from zenpy.lib.util import is_iterable_but_not_string, to_unix_ts
    from urllib import urlencode
    from urlparse import urlunsplit, SplitResult
    from urllib.parse import urlencode
    from urllib.parse import urlunsplit, SplitResult
        elif isinstance(start_time, datetime):
            unix_time = to_unix_ts(start_time)
        else:
            unix_time = start_time

        params = dict(start_time=str(unix_time))
        if per_page:
            params["per_page"] = per_page
        if include is not None:
            if is_iterable_but_not_string(include):
                params.update(dict(include=",".join(include)))
            else:
                params.update(dict(include=include))
        return Url(self.endpoint, params=params)


class ChatIncrementalEndpoint(BaseEndpoint):
    """
    An ChatsIncrementalEndpoint takes parameters
    for querying the chats incremental api endpoint.

    Note: The Zendesk API expects UTC time. If a timezone aware datetime object is passed
    Zenpy will convert it to UTC, however if a naive object or unix timestamp is passed there is nothing
    Zenpy can do. It is recommended to always pass timezone aware objects to this endpoint.

    :param start_time: unix timestamp or datetime object
    :param fields: list of chat fields to load without "chats(xxx)". Defaults to "*"
    """
    def __call__(self, start_time=None, **kwargs):
        if start_time is None:

# Path: zenpy/lib/exception.py
# class ZenpyException(Exception):
#     """
#     A ``ZenpyException`` is raised for internal errors.
#     """
# 
# Path: zenpy/lib/util.py
# def is_iterable_but_not_string(obj):
#     """
#     Determine whether or not obj is iterable but not a string (eg, a list, set, tuple etc).
#     """
#     return hasattr(obj, '__iter__') and not isinstance(
#         obj, str) and not isinstance(obj, bytes)
# 
# def to_unix_ts(start_time):
#     """Given a datetime object, returns its value as a unix timestamp"""
#     if isinstance(start_time, datetime):
#         if is_timezone_aware(start_time):
#             start_time = start_time.astimezone(pytz.utc)
#         else:
#             log.warning(
#                 "Non timezone-aware datetime object passed to IncrementalEndpoint. "
#                 "The Zendesk API expects UTC time, if this is not the case results will be incorrect!"
#             )
#         unix_time = calendar.timegm(start_time.timetuple())
#     else:
#         unix_time = start_time
# 
#     return int(unix_time)


# Path: zenpy/lib/endpoint.py
import logging
from datetime import date
from datetime import datetime
from requests.utils import quote
from zenpy.lib.exception import ZenpyException
from zenpy.lib.util import is_iterable_but_not_string, to_unix_ts
    from urllib import urlencode
    from urlparse import urlunsplit, SplitResult
    from urllib.parse import urlencode
    from urllib.parse import urlunsplit, SplitResult

        elif isinstance(start_time, datetime):
            unix_time = to_unix_ts(start_time)
        else:
            unix_time = start_time

        params = dict(start_time=str(unix_time))
        if per_page:
            params["per_page"] = per_page
        if include is not None:
            if is_iterable_but_not_string(include):
                params.update(dict(include=",".join(include)))
            else:
                params.update(dict(include=include))
        return Url(self.endpoint, params=params)


class ChatIncrementalEndpoint(BaseEndpoint):
    """
    An ChatsIncrementalEndpoint takes parameters
    for querying the chats incremental api endpoint.

    Note: The Zendesk API expects UTC time. If a timezone aware datetime object is passed
    Zenpy will convert it to UTC, however if a naive object or unix timestamp is passed there is nothing
    Zenpy can do. It is recommended to always pass timezone aware objects to this endpoint.

    :param start_time: unix timestamp or datetime object
    :param fields: list of chat fields to load without "chats(xxx)". Defaults to "*"
    """
    def __call__(self, start_time=None, **kwargs):
        if start_time is None:

            raise ZenpyException(