Uploaded image for project: 'Kayako Python API Library'
  1. Kayako Python API Library
  2. PYTHONAPI-16

Python API library cannot be used for getting the ticket count

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Labels:
      None

      Description

      Python API Library fails for 'TicketCount'.

      Part of the TicketCount returned by our test instance of Kayako is:
      <department id="2">
      <totalitems><![CDATA[21]]></totalitems>
      <lastactivity><![CDATA[1458584832]]></lastactivity>
      <totalunresolveditems />
      <ticketstatus id="3" lastactivity="1458584832" totalitems="21" />
      <tickettype id="1" lastactivity="1458584832" totalitems="21" totalunresolveditems="0" />
      <ownerstaff id="0" lastactivity="1454612990" totalitems="6" totalunresolveditems="0" />
      <ownerstaff id="1" lastactivity="1458584832" totalitems="15" totalunresolveditems="0" />
      </department>

      When this is parsed by the Python API library, the following exception is thrown:

      KayakoResponseError: There was an error parsing the response (_get_int(<Element totalunresolveditems at 0x7f38040de878>, required=True, strict=True):
      int() argument must be a string or a number, not 'NoneType'

      As a result, the Python API library can not be used at all for getting a ticket count.

      The code producing the exception is as follows:

      #!/usr/bin/python
      import kayako
      kurl = ' https://dev-support.steadfast.net/api/index.php'
      kkey = '5e9ab34e-d406-6e04-dd96-b0e13995a206'
      ksecret = 'SECRETHERE'
      kapi = kayako.KayakoAPI(kurl, kkey, ksecret)
      kapi.get_all(kayako.TicketCount)

      As you can see, everything is being performed by the API library. To reproduce the exception, you will need to make sure to have a Kayako department which contains an entry of "<totalunresolveditems />" as the library seems to assume that totalunresolveditems can always be parsed to an integer despite the fact that is not always true.

        Attachments

          Activity

            People

            • Assignee:
              ravi.sharma Ravi Sharma
              Reporter:
              sukhpreet.kaur Sukhpreet Kaur
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: