def __init__(self, subdomain=None, email=None, token=None, oauth_token=None, password=None, session=None, timeout=None, ratelimit=None, ratelimit_budget=None): """ Python Wrapper for the Zendesk API. There are several ways to authenticate with the Zendesk API: * Email and password * Email and Zendesk API token * Email and OAuth token * Existing authenticated Requests Session object. :param subdomain: your Zendesk subdomain :param email: email address :param token: Zendesk API token :param oauth_token: OAuth token :param password: Zendesk password :param session: existing Requests Session object :param timeout: global timeout on API requests. :param ratelimit: user specified rate limit :param ratelimit_budget: maximum time to spend being rate limited """ session = self._init_session(email, token, oauth_token, password, session) timeout = timeout or self.DEFAULT_TIMEOUT config = dict( subdomain=subdomain, session=session, timeout=timeout, ratelimit=int(ratelimit) if ratelimit is not None else None, ratelimit_budget=int(ratelimit_budget) if ratelimit_budget is not None else None) self.users = UserApi(config) self.user_fields = Api(config, object_type='user_field') self.groups = GroupApi(config) self.macros = MacroApi(config) self.organizations = OrganizationApi(config) self.organization_memberships = OrganizationMembershipApi(config) self.tickets = TicketApi(config) self.suspended_tickets = SuspendedTicketApi( config, object_type='suspended_ticket') self.search = Api(config, object_type='results', endpoint=EndpointFactory('search')) self.topics = Api(config, object_type='topic') self.attachments = AttachmentApi(config) self.brands = BrandApi(config, object_type='brand') self.job_status = Api(config, object_type='job_status', endpoint=EndpointFactory('job_statuses')) self.tags = Api(config, object_type='tag') self.satisfaction_ratings = SatisfactionRatingApi(config) self.sharing_agreements = SharingAgreementAPI(config) self.activities = Api(config, object_type='activity') self.group_memberships = GroupMembershipApi(config) self.end_user = EndUserApi(config) self.ticket_metrics = Api(config, object_type='ticket_metric') self.ticket_fields = TicketFieldApi(config, object_type='ticket_field') self.ticket_forms = TicketFormApi(config, object_type='ticket_form') self.ticket_import = TicketImportAPI(config) self.requests = RequestAPI(config) self.chats = ChatApi(config, endpoint=EndpointFactory('chats')) self.views = ViewApi(config) self.sla_policies = SlaPolicyApi(config) self.help_center = HelpCentreApi(config) self.recipient_addresses = RecipientAddressApi(config) self.nps = NpsApi(config) self.triggers = TriggerApi(config, object_type='trigger') self.automations = AutomationApi(config, object_type='automation') self.dynamic_content = DynamicContentApi( config, object_type='dynamic_content_item') self.targets = TargetApi(config, object_type='target')
def __init__(self, domain='zendesk.com', subdomain=None, email=None, token=None, oauth_token=None, password=None, session=None, timeout=None, ratelimit_budget=None, proactive_ratelimit=None, proactive_ratelimit_request_interval=10, disable_cache=False): """ Python Wrapper for the Zendesk API. There are several ways to authenticate with the Zendesk API: * Email and password * Email and Zendesk API token * Email and OAuth token * Existing authenticated Requests Session object. :param subdomain: your Zendesk subdomain :param email: email address :param token: Zendesk API token :param oauth_token: OAuth token :param password: Zendesk password :param session: existing Requests Session object :param timeout: global timeout on API requests. :param ratelimit_budget: maximum time to spend being rate limited :param proactive_ratelimit: user specified rate limit. :param proactive_ratelimit_request_interval: seconds to wait when over proactive_ratelimit. :param disable_cache: disable caching of objects """ session = self._init_session(email, token, oauth_token, password, session) timeout = timeout or self.DEFAULT_TIMEOUT self.cache = ZenpyCacheManager(disable_cache) config = dict( domain=domain, subdomain=subdomain, session=session, timeout=timeout, ratelimit=int(proactive_ratelimit) if proactive_ratelimit is not None else None, ratelimit_budget=int(ratelimit_budget) if ratelimit_budget is not None else None, ratelimit_request_interval=int(proactive_ratelimit_request_interval), cache=self.cache ) self.users = UserApi(config) self.user_fields = UserFieldsApi(config) self.groups = GroupApi(config) self.macros = MacroApi(config) self.organizations = OrganizationApi(config) self.organization_memberships = OrganizationMembershipApi(config) self.organization_fields = OrganizationFieldsApi(config) self.tickets = TicketApi(config) self.suspended_tickets = SuspendedTicketApi(config, object_type='suspended_ticket') self.search = SearchApi(config) self.topics = Api(config, object_type='topic') self.attachments = AttachmentApi(config) self.brands = BrandApi(config, object_type='brand') self.job_status = Api(config, object_type='job_status', endpoint=EndpointFactory('job_statuses')) self.jira_links = JiraLinkApi(config) self.tags = Api(config, object_type='tag') self.satisfaction_ratings = SatisfactionRatingApi(config) self.sharing_agreements = SharingAgreementAPI(config) self.skips = SkipApi(config) self.activities = Api(config, object_type='activity') self.group_memberships = GroupMembershipApi(config) self.end_user = EndUserApi(config) self.ticket_metrics = Api(config, object_type='ticket_metric') self.ticket_metric_events = Api(config, object_type='ticket_metric_events') self.ticket_fields = TicketFieldApi(config) self.ticket_forms = TicketFormApi(config, object_type='ticket_form') self.ticket_import = TicketImportAPI(config) self.requests = RequestAPI(config) self.chats = ChatApi(config, endpoint=EndpointFactory('chats')) self.views = ViewApi(config) self.sla_policies = SlaPolicyApi(config) self.help_center = HelpCentreApi(config) self.recipient_addresses = RecipientAddressApi(config) self.nps = NpsApi(config) self.triggers = TriggerApi(config, object_type='trigger') self.automations = AutomationApi(config, object_type='automation') self.dynamic_content = DynamicContentApi(config) self.targets = TargetApi(config, object_type='target') self.talk = TalkApi(config) self.custom_agent_roles = CustomAgentRolesApi(config, object_type='custom_agent_role')