<s> from __future__ import print_function <EOL> import sys <EOL> from zdesk import Zendesk <EOL> try : <EOL> import zdeskcfg <EOL> zendesk = Zendesk ( ** zdeskcfg . get_ini_config ( section = '<STR_LIT>' ) ) <EOL> except ImportError : <EOL> testconfig = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True <EOL> } <EOL> if testconfig [ '<STR_LIT>' ] == '<STR_LIT>' : <EOL> print ( <EOL> '<STR_LIT>' ) <EOL> print ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> sys . exit ( ) <EOL> else : <EOL> zendesk = Zendesk ( ** testconfig ) <EOL> zendesk . tickets_list ( ) <EOL> new_ticket = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:description>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' : [ <EOL> { <EOL> '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT:value>' : '<STR_LIT>' <EOL> } , <EOL> { <EOL> '<STR_LIT>' : <NUM_LIT:2> , <EOL> '<STR_LIT:value>' : '<STR_LIT>' <EOL> } <EOL> ] <EOL> } <EOL> } <EOL> result = zendesk . ticket_create ( data = new_ticket ) <EOL> from zdesk import get_id_from_url <EOL> ticket_id = get_id_from_url ( result ) <EOL> zendesk . ticket_show ( id = ticket_id ) <EOL> commentbody = "<STR_LIT>" <EOL> fname = '<STR_LIT>' <EOL> with open ( fname , '<STR_LIT:rb>' ) as fp : <EOL> fdata = fp . read ( ) <EOL> mime_type = '<STR_LIT>' <EOL> upload_result = zendesk . upload_create ( <EOL> fdata , filename = fname , mime_type = mime_type , complete_response = True ) <EOL> upload_token = upload_result [ '<STR_LIT:content>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> data = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:id>" : ticket_id , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : False , <EOL> "<STR_LIT:body>" : commentbody <EOL> } <EOL> } <EOL> } <EOL> if upload_token != "<STR_LIT>" : <EOL> data [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] = [ upload_token ] <EOL> response = zendesk . ticket_update ( ticket_id , data ) <EOL> zendesk . ticket_delete ( id = ticket_id ) <EOL> zendesk . organizations_list ( ) <EOL> new_org = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:name>' : '<STR_LIT>' <EOL> } <EOL> } <EOL> result = zendesk . organization_create ( data = new_org ) <EOL> org_id = get_id_from_url ( result ) <EOL> zendesk . organization_show ( id = org_id ) <EOL> zendesk . organization_delete ( id = org_id ) <EOL> zendesk . users_list ( ) <EOL> new_user = { <EOL> '<STR_LIT:user>' : { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT:email>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:4> , <EOL> } <EOL> } <EOL> result = zendesk . user_create ( data = new_user ) <EOL> user_id = get_id_from_url ( result ) <EOL> zendesk . user_show ( id = user_id ) <EOL> zendesk . user_delete ( id = user_id ) <EOL> zendesk . groups_list ( ) <EOL> new_group = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ <EOL> { <EOL> '<STR_LIT>' : <NUM_LIT> <EOL> } , <EOL> ] <EOL> } <EOL> } <EOL> result = zendesk . group_create ( data = new_group ) <EOL> group_id = get_id_from_url ( result ) <EOL> zendesk . group_show ( id = group_id ) <EOL> zendesk . group_delete ( id = group_id ) <EOL> zendesk . tags_list ( ) <EOL> zendesk . ticket_fields_list ( ) <EOL> results = zendesk . search ( query = '<STR_LIT>' , page = <NUM_LIT:1> ) </s>
