Python Client SDK for Zendesk Support API.
Project description
python-zendesk
Provided by botBrains. This SDK is generated for the Zendesk Support API openapi spec (also known as Zendesk Ticketing API). We slightly modified it to comply with the OpenAPI spec and to work with the speakeasy codegen tool, as well as adding partial pagination support.
How to regenerate the SDK
sh scripts/generate.sh
Summary
Support API: Zendesk Support API endpoints
Table of Contents
SDK Installation
[!NOTE] Python version upgrade policy
Once a Python version reaches its official end of life date, a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.
The SDK can be installed with either pip or poetry package managers.
PIP
PIP is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.
pip install python-zendesk
Poetry
Poetry is a modern tool that simplifies dependency management and package publishing by using a single pyproject.toml file to handle project metadata and dependencies.
poetry add python-zendesk
Shell and script usage with uv
You can use this SDK in a Python shell with uv and the uvx command that comes with it like so:
uvx --from python-zendesk python
It's also possible to write a standalone Python script without needing to set up a whole project like so:
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.9"
# dependencies = [
# "python-zendesk",
# ]
# ///
from zendesk import Zendesk
sdk = Zendesk(
# SDK arguments
)
# Rest of script here...
Once that is saved to a file, you can run it with uv run script.py where
script.py can be replaced with the actual file name.
IDE Support
PyCharm
Generally, the SDK will work well with most IDEs out of the box. However, when using PyCharm, you can enjoy much better integration with Pydantic by installing an additional plugin.
SDK Example Usage
Example
# Synchronous Example
from zendesk import Zendesk, models
with Zendesk(
security=models.Security(
username="",
password="",
),
) as z_client:
res = z_client.assignee_field_assignable_groups.list_assignee_field_assignable_groups_and_agents_search(name="Johnny Agent")
# Handle response
print(res)
The same SDK client can also be used to make asychronous requests by importing asyncio.
# Asynchronous Example
import asyncio
from zendesk import Zendesk, models
async def main():
async with Zendesk(
security=models.Security(
username="",
password="",
),
) as z_client:
res = await z_client.assignee_field_assignable_groups.list_assignee_field_assignable_groups_and_agents_search_async(name="Johnny Agent")
# Handle response
print(res)
asyncio.run(main())
Authentication
Per-Client Security Schemes
This SDK supports the following security scheme globally:
| Name | Type | Scheme | Environment Variable |
|---|---|---|---|
usernamepassword |
http | HTTP Basic | ZENDESK_USERNAMEZENDESK_PASSWORD |
You can set the security parameters through the security optional parameter when initializing the SDK client instance. For example:
from zendesk import Zendesk, models
with Zendesk(
security=models.Security(
username="",
password="",
),
) as z_client:
res = z_client.assignee_field_assignable_groups.list_assignee_field_assignable_groups_and_agents_search(name="Johnny Agent")
# Handle response
print(res)
Available Resources and Operations
Available methods
account_settings
- show_account_settings - Show Settings
- update_account_settings - Update Account Settings
activity_stream
- list_activities - List Activities
- show_activity - Show Activity
- count_activities - Count Activities
approval_requests
- create_approval_request - Create an Approval Request
- show_approval_request - Show Approval Request
- update_decision_approval_request - Update Approval Request Status
- search_approvals - Get Approvals by Approval Workflow Id
approval_workflow_instances
- create_approval_workflow_instance - Create Approval Workflow Instance
assignee_field_assignable_agents
- list_assignee_field_assignable_groups_and_agents_search - List assignable groups and agents based on query matched against name
- list_assignee_field_assignable_groups - List assignable groups on the AssigneeField
- list_assignee_field_assignable_group_agents - List assignable agents from a group on the AssigneeField
assignee_field_assignable_groups
- list_assignee_field_assignable_groups_and_agents_search - List assignable groups and agents based on query matched against name
attachments
- show_attachment - Show Attachment
- update_attachment - Update Attachment for Malware
- redact_comment_attachment - Redact Comment Attachment
- upload_files - Upload Files
- delete_upload - Delete Upload
audit_logs
- list_audit_logs - List Audit Logs
- show_audit_log - Show Audit Log
- export_audit_logs - Export Audit Logs
automations
- list_automations - List Automations
- create_automation - Create Automation
- show_automation - Show Automation
- update_automation - Update Automation
- delete_automation - Delete Automation
- list_active_automations - List Active Automations
- bulk_delete_automations - Bulk Delete Automations
- search_automations - Search Automations
- update_many_automations - Update Many Automations
basics
- open_ticket_in_agent_browser - Open Ticket in Agent's Browser
- open_users_profile_in_agent_browser - Open a User's Profile in an Agent's Browser
- create_ticket_or_voicemail_ticket - Create Ticket or Voicemail Ticket
bookmarks
- list_bookmarks - List Bookmarks
- create_bookmark - Create Bookmark
- delete_bookmark - Delete Bookmark
brand_agents
- list_brand_agents - List Brand Agent Memberships
- show_brand_agent_by_id - Show Brand Agent Membership
brands
- list_brands - List Brands
- create_brand - Create Brand
- show_brand - Show a Brand
- update_brand - Update a Brand
- delete_brand - Delete a Brand
- check_host_mapping_validity_for_existing_brand - Check Host Mapping Validity for an Existing Brand
- check_host_mapping_validity - Check Host Mapping Validity
channel_framework
- report_channelback_error - Report Channelback Error to Zendesk
- push_content_to_support - Push Content to Support
- validate_token - Validate Token
conversation_log
- list_conversation_log_for_ticket - List Conversation log for Ticket
custom_object_fields
- list_custom_object_fields - List Custom Object Fields
- create_custom_object_field - Create Custom Object Field
- show_custom_object_field - Show Custom Object Field
- update_custom_object_field - Update Custom Object Field
- delete_custom_object_field - Delete Custom Object Field
- reorder_custom_object_fields - Reorder Custom Fields of an Object
- custom_object_fields_limit - Custom Object Fields Limit
custom_object_records
- custom_object_record_bulk_jobs - Custom Object Record Bulk Jobs
- list_custom_object_records - List Custom Object Records
- create_custom_object_record - Create Custom Object Record
- upsert_custom_object_record_by_external_id_or_name - Set Custom Object Record by External Id Or Name
- delete_custom_object_record_by_external_id_or_name - Delete Custom Object Record by External Id Or Name
- show_custom_object_record - Show Custom Object Record
- update_custom_object_record - Update Custom Object Record
- delete_custom_object_record - Delete Custom Object Record
- autocomplete_custom_object_record_search - Autocomplete Custom Object Record Search
- count_custom_object_records - Count Custom Object Records
- search_custom_object_records - Search Custom Object Records
- filtered_search_custom_object_records - Filtered Search of Custom Object Records
- custom_object_records_limit - Custom Object Records Limit
custom_objects
- list_custom_objects - List Custom Objects
- create_custom_object - Create Custom Object
- show_custom_object - Show Custom Object
- update_custom_object - Update Custom Object
- delete_custom_object - Delete Custom Object
- custom_objects_limit - Custom Objects Limit
custom_roles
- list_custom_roles - List Custom Roles
- create_custom_role - Create Custom Role
- show_custom_role_by_id - Show Custom Role
- update_custom_role_by_id - Update Custom Role
- delete_custom_role_by_id - Delete Custom Role
custom_ticket_statuses
- bulk_update_default_custom_status - Bulk Update Default Custom Ticket Status
- list_custom_statuses - List Custom Ticket Statuses
- create_custom_status - Create Custom Ticket Status
- show_custom_status - Show Custom Ticket Status
- update_custom_status - Update Custom Ticket Status
- create_ticket_form_statuses_for_custom_status - Create Ticket Form Statuses for a Custom Status
deletion_schedules
- list_deletion_schedules - List Deletion Schedules
- create_deletion_schedule - Create Deletion Schedule
- get_deletion_schedule - Get Deletion Schedule
- update_deletion_schedule - Update Deletion Schedule
- delete_deletion_schedule - Delete Deletion Schedule
dynamic_content
- list_dynamic_contents - List Items
- create_dynamic_content - Create Item
- show_dynamic_content_item - Show Item
- update_dynamic_content_item - Update Item
- delete_dynamic_content_item - Delete Item
- show_many_dynamic_contents - Show Many Items
dynamic_content_item_variants
- dynamic_content_list_variants - List Variants
- create_dynamic_content_variant - Create Variant
- show_dynamic_content_variant - Show Variant
- update_dynamic_content_variant - Update Variant
- delete_dynamic_content_variant - Delete Variant
- create_many_dynamic_content_variants - Create Many Variants
- update_many_dynamic_content_variants - Update Many Variants
email_notifications
- list_email_notifications - List Email Notifications
- show_email_notification - Show Email Notification
- show_many_email_notifications - Show Many Email Notifications
essentials_card
- show_essentials_card - Show Essentials Card
- update_essentials_card - Update Essentials Card
- delete_essentials_card - Delete Essentials Card
- show_essentials_cards - List of Essentials Cards
global_clients
- list_global_o_auth_clients - List Global OAuth Clients
grant_type_tokens
- create_token_for_grant_type - Create Token for Grant Type
group_memberships
- list_group_memberships - List Memberships
- create_group_membership - Create Membership
- show_group_membership_by_id - Show Membership
- delete_group_membership - Delete Membership
- list_assignable_group_memberships - List Assignable Memberships
- group_membership_bulk_create - Bulk Create Memberships
- group_membership_bulk_delete - Bulk Delete Memberships
- group_membership_set_default - Set Membership as Default
group_sla_policies
- list_group_sla_policies - List Group SLA Policies
- create_group_sla_policy - Create Group SLA Policy
- show_group_sla_policy - Show Group SLA Policy
- update_group_sla_policy - Update Group SLA Policy
- delete_group_sla_policy - Delete Group SLA Policy
- retrieve_group_sla_policy_filter_definition_items - Retrieve Supported Filter Definition Items
- reorder_group_sla_policies - Reorder Group SLA Policies
groups
- list_groups - List Groups
- create_group - Create Group
- show_group_by_id - Show Group
- update_group - Update Group
- delete_group - Delete Group
- list_assignable_groups - List Assignable Groups
- count_groups - Count Groups
incremental_export
- incremental_sample_export - Incremental Sample Export
- incremental_organization_export - Incremental Organization Export
- incremental_ticket_events - Incremental Ticket Event Export
- incremental_ticket_export_time - Incremental Ticket Export, Time Based
- incremental_ticket_export_cursor - Incremental Ticket Export, Cursor Based
- incremental_user_export_time - Incremental User Export, Time Based
- incremental_user_export_cursor - Incremental User Export, Cursor Based
incremental_skill_based_routing
- incremental_skil_based_routing_attribute_values_export - Incremental Attributes Values Export
- incremental_skil_based_routing_attributes_export - Incremental Attributes Export
- incremental_skil_based_routing_instance_values_export - Incremental Instance Values Export
job_statuses
- list_job_statuses - List Job Statuses
- show_job_status - Show Job Status
- show_many_job_statuses - Show Many Job Statuses
- bulk_set_agent_attribute_values_job - Bulk Set Agent Attribute Values Job
locales
- list_locales - List Locales
- show_locale_by_id - Show Locale
- list_locales_for_agent - List Locales for Agent
- show_current_locale - Show Current Locale
- detect_best_locale - Detect Best Language for User
- list_available_public_locales - List Available Public Locales
lookup_relationships
- get_sources_by_target - Get sources by target
- get_relationship_filter_definitions - Filter Definitions
macros
- list_macros - List Macros
- create_macro - Create Macro
- show_macro - Show Macro
- update_macro - Update Macro
- delete_macro - Delete Macro
- show_changes_to_ticket - Show Changes to Ticket
- list_macro_attachments - List Macro Attachments
- create_associated_macro_attachment - Create Macro Attachment
- list_macros_actions - List Supported Actions for Macros
- list_active_macros - List Active Macros
- create_macro_attachment - Create Unassociated Macro Attachment
- show_macro_attachment - Show Macro Attachment
- list_macro_categories - List Macro Categories
- list_macro_action_definitions - List Macro Action Definitions
- delete_many_macros - Bulk Delete Macros
- show_derived_macro - Show Macro Replica
- search_macro - Search Macros
- update_many_macros - Update Many Macros
- show_ticket_after_changes - Show Ticket After Changes
o_auth_clients
- list_o_auth_clients - List Clients
- create_o_auth_client - Create Client
- show_client - Show Client
- update_client - Update Client
- delete_client - Delete Client
- client_generate_secret - Generate Secret
o_auth_tokens
- list_o_auth_tokens - List Tokens
- create_o_auth_token - Create Token
- show_token - Show Token
- revoke_o_auth_token - Revoke Token
object_triggers
- list_object_triggers - List Object Triggers
- create_object_trigger - Create Object Trigger
- get_object_trigger - Show Object Trigger
- update_object_trigger - Update Object Trigger
- delete_object_trigger - Delete Object Trigger
- list_active_object_triggers - List Active Object Triggers
- list_object_triggers_definitions - List Object Trigger Action and Condition Definitions
- delete_many_object_triggers - Delete Many Object Triggers
- search_object_triggers - Search Object Triggers
- update_many_object_triggers - Update Many Object Triggers
omnichannel_routing_queues
- list_queues - List queues
- create_queue - Create Queue
- show_queue_by_id - Show Queue
- update_queue - Update Queue
- delete_queue - Delete Queue
- list_queue_definitions - List Queue Definitions
- reorder_queues - Reorder Queues
organization_fields
- list_organization_fields - List Organization Fields
- create_organization_field - Create Organization Field
- reorder_organization_field - Reorder Organization Field
organization_memberships
- list_organization_memberships - List Memberships
- create_organization_membership - Create Membership
- show_organization_membership_by_id - Show Membership
- delete_organization_membership - Delete Membership
- create_many_organization_memberships - Create Many Memberships
- delete_many_organization_memberships - Bulk Delete Memberships
- set_organization_membership_as_default - Set Membership as Default
- unassign_organization - Unassign Organization
- set_organization_as_default - Set Organization as Default
organization_subscriptions
- list_organization_subscriptions - List Organization Subscriptions
- create_organization_subscription - Create Organization Subscription
- show_organization_subscription - Show Organization Subscription
- delete_organization_subscription - Delete Organization Subscription
organizations
- show_organization_merge - Show Organization Merge
- list_organizations - List Organizations
- create_organization - Create Organization
- show_organization - Show Organization
- update_organization - Update Organization
- delete_organization - Delete Organization
- create_organization_merge - Merge Organization With Another Organization
- list_organization_merges - List Organization Merges
- organization_related - Show Organization's Related Information
- autocomplete_organizations - Autocomplete Organizations
- count_organizations - Count Organizations
- create_many_organizations - Create Many Organizations
- create_or_update_organization - Create Or Update Organization
- delete_many_organizations - Bulk Delete Organizations
- search_organizations - Search Organizations
- show_many_organizations - Show Many Organizations
- update_many_organizations - Update Many Organizations
push_notification_devices
- push_notification_devices - Bulk Unregister Push Notification Devices
requests
- list_requests - List Requests
- create_request - Create Request
- show_request - Show Request
- update_request - Update Request
- list_comments - Listing Comments
- show_comment - Getting Comments
- search_requests - Search Requests
reseller
- create_trial_account - Create Trial Account
- verify_subdomain_availability - Verify Subdomain Availability
resource_collections
- list_resource_collections - List Resource Collections
- create_resource_collection - Create Resource Collection
- retrieve_resource_collection - Show Resource Collection
- update_resource_collection - Update Resource Collection
- delete_resource_collection - Delete Resource Collection
satisfaction_ratings
- list_satisfaction_ratings - List Satisfaction Ratings
- show_satisfaction_rating - Show Satisfaction Rating
- count_satisfaction_ratings - Count Satisfaction Ratings
- create_ticket_satisfaction_rating - Create a Satisfaction Rating
satisfaction_reasons
- list_satisfaction_rating_reasons - List Reasons for Satisfaction Rating
- show_satisfaction_ratings - Show Reason for Satisfaction Rating
search
- list_search_results - List Search Results
- count_search_results - Show Results Count
- export_search_results - Export Search Results
sessions
- list_sessions - List Sessions
- bulk_delete_sessions_by_user_id - Bulk Delete Sessions
- show_session - Show Session
- delete_session - Delete Session
- delete_authenticated_session - Delete the Authenticated Session
- show_currently_authenticated_session - Show the Currently Authenticated Session
- renew_current_session - Renew the current session
sharing_agreements
- list_sharing_agreements - List Sharing Agreements
- create_sharing_agreement - Create Sharing Agreement
- show_sharing_agreement - Show a Sharing Agreement
- update_sharing_agreement - Update a Sharing Agreement
- delete_sharing_agreement - Delete a Sharing Agreement
skill_based_routing
- list_a_gent_attribute_values - List Agent Attribute Values
- set_agent_attribute_values - Set Agent Attribute Values
- list_many_agents_attribute_values - List Attribute Values for Many Agents
- bulk_set_agent_attribute_values_job - Bulk Set Agent Attribute Values Job
- list_account_attributes - List Account Attributes
- create_attribute - Create Attribute
- show_attribute - Show Attribute
- update_attribute - Update Attribute
- delete_attribute - Delete Attribute
- list_attribute_values - List Attribute Values for an Attribute
- create_attribute_value - Create Attribute Value
- show_attribute_value - Show Attribute Value
- update_attribute_value - Update Attribute Value
- delete_attribute_value - Delete Attribute Value
- list_routing_attribute_definitions - List Routing Attribute Definitions
- list_tickets_fullfilled_by_user - List Tickets Fulfilled by a User
- list_ticket_attribute_values - List Ticket Attribute Values
- set_ticket_attribute_values - Set Ticket Attribute Values
sla_policies
- list_sla_policies - List SLA Policies
- create_sla_policy - Create SLA Policy
- show_sla_policy - Show SLA Policy
- update_sla_policy - Update SLA Policy
- delete_sla_policy - Delete SLA Policy
- retrieve_sla_policy_filter_definition_items - Retrieve Supported Filter Definition Items
- reorder_sla_policies - Reorder SLA Policies
support_addresses
- list_support_addresses - List Support Addresses
- create_support_address - Create Support Address
- show_support_address - Show Support Address
- update_support_address - Update Support Address
- delete_recipient_address - Delete Support Address
- verify_support_address_forwarding - Verify Support Address Forwarding
suspended_tickets
- list_suspended_tickets - List Suspended Tickets
- show_suspended_tickets - Show Suspended Ticket
- delete_suspended_ticket - Delete Suspended Ticket
- recover_suspended_ticket - Recover Suspended Ticket
- suspended_tickets_attachments - Suspended Ticket Attachments
- delete_suspended_tickets - Delete Multiple Suspended Tickets
- export_suspended_tickets - Export Suspended Tickets
- recover_suspended_tickets - Recover Multiple Suspended Tickets
tags
- autocomplete_tags - Search Tags
- list_tags - List Tags
- count_tags - Count Tags
- list_ticket_tags - List Ticket Tags
- set_ticket_tags - Set Ticket Tags
- add_ticket_tags - Add Tags
- remove_ticket_tags - Remove Ticket Tags
- list_organization_tags - List Organization Tags
- set_organization_tags - Set Organization Tags
- add_organization_tags - Add Organization Tags
- remove_organization_tags - Remove Organization Tags
- list_user_tags - List User Tags
- set_user_tags - Set User Tags
- add_user_tags - Add User Tags
- remove_user_tags - Remove User Tags
target_failures
- list_target_failures - List Target Failures
- show_target_failure - Show Target Failure
targets
- list_targets - List Targets
- create_target - Create Target
- show_target - Show Target
- update_target - Update Target
- delete_target - Delete Target
ticket_audits
- list_ticket_audits - List All Ticket Audits
- list_audits_for_ticket - List Audits for a Ticket
- show_ticket_audit - Show Audit
- make_ticket_comment_private_from_audits - Change a Comment From Public To Private
- count_audits_for_ticket - Count Audits for a Ticket
ticket_comments
- redact_chat_comment_attachment - Redact Chat Comment Attachment
- redact_chat_comment - Redact Chat Comment
- redact_ticket_comment_in_agent_workspace - Redact Ticket Comment In Agent Workspace
- list_ticket_comments - List Comments
- make_ticket_comment_private - Make Comment Private
- redact_string_in_comment - Redact String in Comment
- count_ticket_comments - Count Ticket Comments
ticket_fields
- list_ticket_fields - List Ticket Fields
- create_ticket_field - Create Ticket Field
- show_ticketfield - Show Ticket Field
- update_ticket_field - Update Ticket Field
- delete_ticket_field - Delete Ticket Field
- list_ticket_field_options - List Ticket Field Options
- create_or_update_ticket_field_option - Create or Update Ticket Field Option
- show_ticket_field_option - Show Ticket Field Option
- delete_ticket_field_option - Delete Ticket Field Option
- count_ticket_fields - Count Ticket Fields
- reorder_ticket_fields - Reorder Ticket Fields
ticket_form_statuses
- create_ticket_form_statuses_for_custom_status - Create Ticket Form Statuses for a Custom Status
- list_ticket_form_statuses - List Ticket Form Statuses
- show_many_ticket_form_statuses - Show Many Ticket Form Statuses
- ticket_form_ticket_form_statuses - List Ticket Form Statuses of a Ticket Form
- create_ticket_form_statuses - Create Ticket Form Statuses
- update_ticket_form_statuses - Bulk Update Ticket Form Statuses of a Ticket Form
- delete_ticket_form_statuses - Delete Ticket Form Statuses
- update_ticket_form_status_by_id - Update Ticket Form Status By Id
- delete_ticket_form_status_by_id - Delete Ticket Form Status By Id
ticket_forms
- list_ticket_forms - List Ticket Forms
- create_ticket_form - Create Ticket Form
- show_ticket_form - Show Ticket Form
- update_ticket_form - Update Ticket Form
- delete_ticket_form - Delete Ticket Form
- clone_ticket_form - Clone an Already Existing Ticket Form
- ticket_form_ticket_form_statuses - List Ticket Form Statuses of a Ticket Form
- create_ticket_form_statuses - Create Ticket Form Statuses
- update_ticket_form_statuses - Bulk Update Ticket Form Statuses of a Ticket Form
- update_ticket_form_status_by_id - Update Ticket Form Status By Id
- reorder_ticket_forms - Reorder Ticket Forms
- show_many_ticket_forms - Show Many Ticket Forms
ticket_import
- ticket_import - Ticket Import
- ticket_bulk_import - Ticket Bulk Import
ticket_metric_events
- list_ticket_metric_events - List Ticket Metric Events
ticket_metrics
- list_ticket_metrics - List Ticket Metrics
- show_ticket_metrics - Show Ticket Metrics
ticket_skips
- record_new_skip - Record a New Skip for the Current User
- list_ticket_skips - List Ticket Skips
tickets
- list_deleted_tickets - List Deleted Tickets
- delete_ticket_permanently - Delete Ticket Permanently
- restore_deleted_ticket - Restore a Previously Deleted Ticket
- bulk_permanently_delete_tickets - Delete Multiple Tickets Permanently
- bulk_restore_deleted_tickets - Restore Previously Deleted Tickets in Bulk
- list_ticket_problems - List Ticket Problems
- autocomplete_problems - Autocomplete Problems
- list_tickets - List Tickets
- create_ticket - Create Ticket
- show_ticket - Show Ticket
- update_ticket - Update Ticket
- delete_ticket - Delete Ticket
- list_ticket_collaborators - List Collaborators for a Ticket
- list_ticket_email_c_cs - List Email CCs for a Ticket
- list_ticket_followers - List Followers for a Ticket
- list_ticket_incidents - List Ticket Incidents
- mark_ticket_as_spam_and_suspend_requester - Mark Ticket as Spam and Suspend Requester
- merge_tickets_into_target_ticket - Merge Tickets into Target Ticket
- ticket_related_information - Ticket Related Information
- count_tickets - Count Tickets
- tickets_create_many - Create Many Tickets
- bulk_delete_tickets - Bulk Delete Tickets
- mark_many_tickets_as_spam - Bulk Mark Tickets as Spam
- tickets_show_many - Show Multiple Tickets
- tickets_update_many - Update Many Tickets
trigger_categories
- list_trigger_categories - List Ticket Trigger Categories
- create_trigger_category - Create Ticket Trigger Category
- show_trigger_category_by_id - Show Ticket Trigger Category
- update_trigger_category - Update Ticket Trigger Category
- delete_trigger_category - Delete Ticket Trigger Category
- batch_operate_trigger_categories - Create Batch Job for Ticket Trigger Categories
triggers
- list_triggers - List Ticket Triggers
- create_trigger - Create Trigger
- get_trigger - Show Ticket Trigger
- update_trigger - Update Ticket Trigger
- delete_trigger - Delete Ticket Trigger
- list_trigger_revisions - List Ticket Trigger Revisions
- trigger_revision - Show Ticket Trigger Revision
- list_active_triggers - List Active Ticket Triggers
- list_trigger_action_condition_definitions - List Ticket Trigger Action and Condition Definitions
- delete_many_triggers - Bulk Delete Ticket Triggers
- reorder_triggers - Reorder Ticket Triggers
- search_triggers - Search Ticket Triggers
- update_many_triggers - Update Many Ticket Triggers
user_fields
- list_user_fields - List User Fields
- create_user_field - Create User Field
- reorder_user_field - Reorder User Field
user_identities
- list_user_identities - List Identities
- create_user_identity - Create Identity
- show_user_identity - Show Identity
- update_user_identity - Update Identity
- delete_user_identity - Delete Identity
- make_user_identity_primary - Make Identity Primary
- request_user_verfication - Request User Verification
- verify_user_identity - Verify Identity
user_passwords
- set_user_password - Set a User's Password
- change_own_password - Change Your Password
- get_user_password_requirements - List password requirements
users
- list_deleted_users - List Deleted Users
- show_deleted_user - Show Deleted User
- permanently_delete_user - Permanently Delete User
- count_deleted_users - Count Deleted Users
- list_users - List Users
- create_user - Create User
- show_user - Show User
- update_user - Update User
- delete_user - Delete User
- show_user_compliance_deletion_statuses - Show Compliance Deletion Statuses
- merge_end_users - Merge End Users
- show_user_related - Show User Related Information
- autocomplete_users - Autocomplete Users
- count_users - Count Users
- create_many_users - Create Many Users
- create_or_update_user - Create Or Update User
- create_or_update_many_users - Create Or Update Many Users
- destroy_many_users - Bulk Delete Users
- logout_many_users - Logout many users
- show_current_user - Show Self
- request_user_create - Request User Create
- search_users - Search Users
- show_many_users - Show Many Users
- update_many_users - Update Many Users
views
- list_views - List Views
- create_view - Create View
- show_view - Show View
- update_view - Update View
- delete_view - Delete View
- get_view_count - Count Tickets in View
- execute_view - Execute View
- export_view - Export View
- list_tickets_from_view - List Tickets From a View
- list_active_views - List Active Views
- list_compact_views - List Views - Compact
- count_views - Count Views
- get_view_counts - Count Tickets in Views
- bulk_delete_views - Bulk Delete Views
- preview_views - Preview Views
- preview_count - Preview Ticket Count
- search_views - Search Views
- list_views_by_id - List Views By ID
- update_many_views - Update Many Views
webhook_invocations
- list_webhook_invocations - List Webhook Invocations
- list_webhook_invocation_attempts - List Webhook Invocation Attempts
webhooks
- list_webhooks - List Webhooks
- create_or_clone_webhook - Create or Clone Webhook
- test_webhook - Test Webhook
- show_webhook - Show Webhook
- update_webhook - Update Webhook
- patch_webhook - Patch Webhook
- delete_webhook - Delete Webhook
- show_webhook_signing_secret - Show Webhook Signing Secret
- reset_webhook_signing_secret - Reset Webhook Signing Secret
workspaces
- list_workspaces - List Workspaces
- create_workspace - Create Workspace
- show_workspace - Show Workspace
- update_workspace - Update Workspace
- delete_workspace - Delete Workspace
- destroy_many_workspaces - Bulk Delete Workspaces
- reorder_workspaces - Reorder Workspaces
x_channel
- list_monitored_twitter_handles - List Monitored X Handles
- show_monitored_twitter_handle - Show Monitored X Handle
- create_ticket_from_tweet - Create Ticket from Tweet
- getting_twicket_status - List Ticket statuses
Pagination
Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
returned response object will have a Next method that can be called to pull down the next group of results. If the
return value of Next is None, then there are no more pages to be fetched.
Here's an example of one such pagination call:
from zendesk import Zendesk, models
with Zendesk(
security=models.Security(
username="",
password="",
),
) as z_client:
res = z_client.lookup_relationships.get_sources_by_target(target_type="zen:custom_object:apartment", target_id=1234, field_id=1234, source_type="zen:custom_object:apartment", page_size=100)
while res is not None:
# Handle items
res = res.next()
Retries
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
To change the default retry strategy for a single API call, simply provide a RetryConfig object to the call:
from zendesk import Zendesk, models
from zendesk.utils import BackoffStrategy, RetryConfig
with Zendesk(
security=models.Security(
username="",
password="",
),
) as z_client:
res = z_client.assignee_field_assignable_groups.list_assignee_field_assignable_groups_and_agents_search(name="Johnny Agent",
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
# Handle response
print(res)
If you'd like to override the default retry strategy for all operations that support retries, you can use the retry_config optional parameter when initializing the SDK:
from zendesk import Zendesk, models
from zendesk.utils import BackoffStrategy, RetryConfig
with Zendesk(
retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
security=models.Security(
username="",
password="",
),
) as z_client:
res = z_client.assignee_field_assignable_groups.list_assignee_field_assignable_groups_and_agents_search(name="Johnny Agent")
# Handle response
print(res)
Error Handling
Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an exception.
By default, an API error will raise a errors.APIError exception, which has the following properties:
| Property | Type | Description |
|---|---|---|
.status_code |
int | The HTTP status code |
.message |
str | The error message |
.raw_response |
httpx.Response | The raw HTTP response |
.body |
str | The response content |
When custom error responses are specified for an operation, the SDK may also raise their associated exceptions. You can refer to respective Errors tables in SDK docs for more details on possible exception types for each operation. For example, the list_ticket_tags_async method may raise the following exceptions:
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.Error | 404 | application/json |
| errors.APIError | 4XX, 5XX | */* |
Example
from zendesk import Zendesk, errors, models
with Zendesk(
security=models.Security(
username="",
password="",
),
) as z_client:
res = None
try:
res = z_client.tags.list_ticket_tags(ticket_id=123456)
# Handle response
print(res)
except errors.Error as e:
# handle e.data: errors.ErrorData
raise(e)
except errors.APIError as e:
# handle exception
raise(e)
Server Selection
Server Variables
The default server https://{subdomain}.{domain}.com contains variables and is set to https://example.zendesk.com by default. To override default values, the following parameters are available when initializing the SDK client instance:
| Variable | Parameter | Default | Description |
|---|---|---|---|
domain |
domain: str |
"zendesk" |
|
subdomain |
subdomain: str |
"example" |
Example
from zendesk import Zendesk, models
with Zendesk(
domain="unwelcome-bidet.info"
subdomain="<value>"
security=models.Security(
username="",
password="",
),
) as z_client:
res = z_client.assignee_field_assignable_groups.list_assignee_field_assignable_groups_and_agents_search(name="Johnny Agent")
# Handle response
print(res)
Override Server URL Per-Client
The default server can be overridden globally by passing a URL to the server_url: str optional parameter when initializing the SDK client instance. For example:
from zendesk import Zendesk, models
with Zendesk(
server_url="https://example.zendesk.com",
security=models.Security(
username="",
password="",
),
) as z_client:
res = z_client.assignee_field_assignable_groups.list_assignee_field_assignable_groups_and_agents_search(name="Johnny Agent")
# Handle response
print(res)
Custom HTTP Client
The Python SDK makes API calls using the httpx HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with your own HTTP client instance.
Depending on whether you are using the sync or async version of the SDK, you can pass an instance of HttpClient or AsyncHttpClient respectively, which are Protocol's ensuring that the client has the necessary methods to make API calls.
This allows you to wrap the client with your own custom logic, such as adding custom headers, logging, or error handling, or you can just pass an instance of httpx.Client or httpx.AsyncClient directly.
For example, you could specify a header for every request that this sdk makes as follows:
from zendesk import Zendesk
import httpx
http_client = httpx.Client(headers={"x-custom-header": "someValue"})
s = Zendesk(client=http_client)
or you could wrap the client with your own custom logic:
from zendesk import Zendesk
from zendesk.httpclient import AsyncHttpClient
import httpx
class CustomClient(AsyncHttpClient):
client: AsyncHttpClient
def __init__(self, client: AsyncHttpClient):
self.client = client
async def send(
self,
request: httpx.Request,
*,
stream: bool = False,
auth: Union[
httpx._types.AuthTypes, httpx._client.UseClientDefault, None
] = httpx.USE_CLIENT_DEFAULT,
follow_redirects: Union[
bool, httpx._client.UseClientDefault
] = httpx.USE_CLIENT_DEFAULT,
) -> httpx.Response:
request.headers["Client-Level-Header"] = "added by client"
return await self.client.send(
request, stream=stream, auth=auth, follow_redirects=follow_redirects
)
def build_request(
self,
method: str,
url: httpx._types.URLTypes,
*,
content: Optional[httpx._types.RequestContent] = None,
data: Optional[httpx._types.RequestData] = None,
files: Optional[httpx._types.RequestFiles] = None,
json: Optional[Any] = None,
params: Optional[httpx._types.QueryParamTypes] = None,
headers: Optional[httpx._types.HeaderTypes] = None,
cookies: Optional[httpx._types.CookieTypes] = None,
timeout: Union[
httpx._types.TimeoutTypes, httpx._client.UseClientDefault
] = httpx.USE_CLIENT_DEFAULT,
extensions: Optional[httpx._types.RequestExtensions] = None,
) -> httpx.Request:
return self.client.build_request(
method,
url,
content=content,
data=data,
files=files,
json=json,
params=params,
headers=headers,
cookies=cookies,
timeout=timeout,
extensions=extensions,
)
s = Zendesk(async_client=CustomClient(httpx.AsyncClient()))
Resource Management
The Zendesk class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a context manager and reuse it across the application.
from zendesk import Zendesk, models
def main():
with Zendesk(
security=models.Security(
username="",
password="",
),
) as z_client:
# Rest of application here...
# Or when using async:
async def amain():
async with Zendesk(
security=models.Security(
username="",
password="",
),
) as z_client:
# Rest of application here...
Debugging
You can setup your SDK to emit debug logs for SDK requests and responses.
You can pass your own logger class directly into your SDK.
from zendesk import Zendesk
import logging
logging.basicConfig(level=logging.DEBUG)
s = Zendesk(debug_logger=logging.getLogger("zendesk"))
You can also enable a default debug logger by setting an environment variable ZENDESK_DEBUG to true.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_zendesk-0.1.11.tar.gz.
File metadata
- Download URL: python_zendesk-0.1.11.tar.gz
- Upload date:
- Size: 429.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f529e8f03b338fb55f6fa348e1417f97a2f910cc5376e74542860f7519f6314
|
|
| MD5 |
6d5265dc4d2e73a4c05b35af2b85dca2
|
|
| BLAKE2b-256 |
bd235f08995a38acacea4d8fdb06b527a9bf4ef17743a607b1e34b9f52f66d30
|
File details
Details for the file python_zendesk-0.1.11-py3-none-any.whl.
File metadata
- Download URL: python_zendesk-0.1.11-py3-none-any.whl
- Upload date:
- Size: 951.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45ef9526d42c0bd8ab1f6ff12f61936d922dc20d940d375c5b9dfd4df2da29dc
|
|
| MD5 |
bd81822d32773b0e66392abaf65151fb
|
|
| BLAKE2b-256 |
24f7dd459537262762a44ec3f53ae6f8bb474a1c20ae6e10bf874566d245f9a0
|