Giter Club home page Giter Club logo

zenpy's Introduction

Zenpy

Zenpy is a Python wrapper for the Zendesk API. The goal of the project is to make it possible 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.

The wrapper supports both reading and writing from the API.

Zenpy supports both Python2 and Python3.

Please report bugs!

Quickstart

# Create a Zenpy object
zenpy = Zenpy(**credentials)

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

# Perform a simple search
for ticket in zenpy.search("party", type='ticket', assignee="face"):
    print(ticket)

Examples

Commenting on a ticket
from zenpy.lib.api_objects import Comment

ticket = zenpy.tickets(id=some_ticket_id)
ticket.comment = Comment(body="Important private comment", public=False)
zenpy.tickets.update(ticket)
Uploading an attachment
from zenpy.lib.api_objects import Comment

# Upload the file to Zendesk and obtain a Upload object
upload_object = zenpy.attachments.upload('/tmp/awesome_file.txt')

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

ticket_audit = zenpy.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.tickets(id=some_ticket_id)
ticket.custom_fields.append(CustomField(id=43528467, value=1337))
zenpy.tickets.update(ticket)

Documentation

Check out the documentation for more info.

Contributions

Contributions are very welcome.

zenpy's People

Contributors

dym avatar facetoe avatar facetoe-work avatar michaelcosby avatar urishalit avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.