How to use the pyotrs.Ticket function in pyotrs

To help you get started, we’ve selected a few pyotrs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rapid7 / insightconnect-plugins / otrs / komand_otrs / actions / create / action.py View on Github external
else:
                raise Exception("Parameter {} was not found. This is required to create a ticket".format(basic_param))
        # left over params added to other_basics
        other_basics = {}
        for k, v in params.items():
            if v:
                other_basics[k] = v
        # build attachments
        attachments = []
        for attachment in new_attachments:
            a = Attachment.create_basic(Content=attachment["content"], ContentType=mimetypes.guess_type(attachment["filename"])[0], Filename=attachment["filename"])
            attachments.append(a)
        # build dynamic fields
        dynamic_fields = list(map(lambda f: DynamicField(**f), new_dynamic_fields))
        # create ticket from basics and all other params
        new_ticket = Ticket.create_basic(**basics)
        new_article = Article(new_article)
        new_attachments = attachments
        new_dynamic_fields = dynamic_fields

        # Create Ticket
        ticket_results = client.ticket_create(
            ticket=new_ticket,
            article=new_article,
            attachments=new_attachments,
            dynamic_fields=new_dynamic_fields,
            **other_basics
        )

        ticket_id = ticket_results.get("TicketID")
        # check if pendingtime is left unmodified
        if params.get("PendingTime").startswith("0001-01-01"):

pyotrs

Python wrapper for OTRS (using REST API)

MIT
Latest version published 7 months ago

Package Health Score

53 / 100
Full package analysis