All Projects → facetoe → Zenpy

facetoe / Zenpy

Licence: gpl-3.0
Python wrapper for the Zendesk API

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Zenpy

Fbrecog
An unofficial python wrapper for the Facebook face recognition endpoint
Stars: ✭ 184 (-17.12%)
Mutual labels:  api, wrapper, python-wrapper
Swaddle
Automagically create API clients/wrappers in JavaScript
Stars: ✭ 23 (-89.64%)
Mutual labels:  api, wrapper, client
Python Twitch Client
Python wrapper for Twitch API
Stars: ✭ 137 (-38.29%)
Mutual labels:  api, wrapper, client
Api struct
API wrapper builder with response serialization
Stars: ✭ 224 (+0.9%)
Mutual labels:  api, wrapper
Notion Js
🤯 Notion API
Stars: ✭ 136 (-38.74%)
Mutual labels:  api, client
Mailjet Apiv3 Nodejs
[API v3] Official Mailjet API v3 NodeJS wrapper
Stars: ✭ 137 (-38.29%)
Mutual labels:  api, wrapper
Tooty
An alternative multi-accounts Web client for Mastodon.
Stars: ✭ 124 (-44.14%)
Mutual labels:  api, client
Swiftyinsta
Instagram Private API Swift
Stars: ✭ 165 (-25.68%)
Mutual labels:  api, client
Deeply
PHP client for the DeepL.com translation API (unofficial)
Stars: ✭ 152 (-31.53%)
Mutual labels:  api, client
Spaces Api
An API wrapper for DigitalOcean's Spaces object storage designed for easy use.
Stars: ✭ 166 (-25.23%)
Mutual labels:  api, wrapper
Smudge
Control the Spotify app from within Emacs.
Stars: ✭ 186 (-16.22%)
Mutual labels:  api, client
Uniswap Python
🦄 The unofficial Python client for the Uniswap exchange.
Stars: ✭ 191 (-13.96%)
Mutual labels:  api, wrapper
Mastodonkit
MastodonKit is a Swift Framework that wraps Mastodon's API
Stars: ✭ 134 (-39.64%)
Mutual labels:  api, wrapper
Coinbasepro Csharp
The unofficial .NET/C# client library for the Coinbase Pro/GDAX API
Stars: ✭ 143 (-35.59%)
Mutual labels:  api, wrapper
Jstp
Fast RPC for browser and Node.js based on TCP, WebSocket, and MDSF
Stars: ✭ 132 (-40.54%)
Mutual labels:  api, client
Restrequest4delphi
API to consume REST services written in any programming language with support to Lazarus and Delphi
Stars: ✭ 162 (-27.03%)
Mutual labels:  api, client
Node Fb Messenger
✉️ Facebook Messenger Platform Node.js API Wrapper
Stars: ✭ 206 (-7.21%)
Mutual labels:  api, wrapper
Kayn
superagent-inspired Node.js lib (w/ **some** TypeScript support) for accessing Riot's League of Legend's API (discord: cnguy#3614)
Stars: ✭ 122 (-45.05%)
Mutual labels:  api, wrapper
Colore
A powerful C# library for Razer Chroma's SDK
Stars: ✭ 121 (-45.5%)
Mutual labels:  api, wrapper
Wiki
Wikipedia Interface for Node.js
Stars: ✭ 180 (-18.92%)
Mutual labels:  api, wrapper

Build Status

Zenpy

Zenpy is a Python wrapper for the Zendesk, Chat and HelpCentre APIs. The goal of the project is to make it easy to write clean, fast, Pythonic code when interacting with Zendesk progmatically. The wrapper tries to keep API calls to a minimum. Wherever it makes sense objects are cached, and attributes of objects that would trigger an API call are evaluated lazily.

Zenpy supports both Python2 and Python3.

Please report bugs!

Quickstart

from zenpy import Zenpy
# Create a Zenpy instance
zenpy_client = Zenpy(**credentials)

# Create a new ticket
zenpy_client.tickets.create(Ticket(subject="Important", description="Thing"))

# Perform a simple search
for ticket in zenpy_client.search('PC LOAD LETTER', type='ticket', assignee='facetoe'):
    # No need to mess around with ids, linked objects can be accessed directly.
    print(ticket.requester.name)

    # All objects can be converted to a Python dict.
    print(ticket.to_dict())

    # Or to JSON.
    print(ticket.to_json())

Examples

Searching open and pending tickets for a specific user and sort them by descending
zenpy_client.search(type='ticket', status_less_than='closed', assignee='[email protected]', sort_order='desc')
Searching only opened tickets
zenpy_client.search(type='ticket', status='open')
Creating a ticket with a different requester
from zenpy.lib.api_objects import Ticket, User

zenpy_client.tickets.create(
    Ticket(description='Some description',
           requester=User(name='bob', email='[email protected]'))
)
Commenting on a ticket
from zenpy.lib.api_objects import Comment

ticket = zenpy_client.tickets(id=some_ticket_id)
ticket.comment = Comment(body="Important private comment", public=False)
zenpy_client.tickets.update(ticket)
Adding a HTML comment to a ticket
from zenpy.lib.api_objects import Ticket, Comment

zenpy_client.tickets.create(Ticket(
    subject='Html comment example',
    comment=Comment(body='The smoke is very colorful',
                    html_body='<h2>The smoke is <i>very</i> colourful</h2>'))
)
Appending tags to a ticket
from zenpy.lib.api_objects import Ticket

ticket = zenpy_client.tickets(id=some_ticket_id)
ticket.tags.extend(['onetag', 'twotag', 'threetag', 'four'])
zenpy_client.tickets.update(ticket)
Uploading an attachment
from zenpy.lib.api_objects import Comment

# Upload the file (or file-like object) to Zendesk and obtain an Upload instance
upload_instance = zenpy_client.attachments.upload('/tmp/awesome_file.txt')

ticket = zenpy_client.tickets(id=some_ticket_id)
ticket.comment = Comment(body='This comment has my file attached', uploads=[upload_instance.token])
zenpy_client.tickets.update(ticket)
Creating a ticket with a custom field set
from zenpy.lib.api_objects import CustomField, Ticket

ticket_audit = zenpy_client.tickets.create(Ticket(
    subject='Has custom field',
    description="Wow, such field",
    custom_fields=[CustomField(id=43528467, value=1337)]
))
Updating a custom field on a ticket
from zenpy.lib.api_objects import CustomField
ticket = zenpy_client.tickets(id=some_ticket_id)
ticket.custom_fields.append(CustomField(id=43528467, value=1337))
zenpy_client.tickets.update(ticket)
Applying a Macro to a ticket
# Execute the show_macro_effect() method which returns what the macro *would* do.
# The method accepts either Zenpy objects or ids. 
macro_result = zenpy_client.tickets.show_macro_effect(ticket_id_or_object, macro_id_or_object)

# Update the ticket to actually change the ticket. 
zenpy_client.tickets.update(macro_result.ticket)
Adding a photo to a user
user = zenpy_client.users(id=user_id)
user.remote_photo_url = 'http://domain/example_photo.jpg'
zenpy_client.users.update(user)

Documentation

Check out the documentation for more info.

Contributions

Contributions are very welcome. I've written an explanation of the core ideas of the wrapper in the Contributors Guide.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].