GrowthPath / zoho_analytics_connector

zoho analytics API wrapper in python 3 (work in progress)
Other
12 stars 3 forks source link

addRow sends columnValues as URLEncoded data #1

Closed jmpb closed 4 years ago

jmpb commented 4 years ago

Firstly, I realised this is an issue in the modified library from Zoho/adventnet but your package has helped me a lot so I thought I would point this bug out here rather than it falling on deaf ears.

The ReportClient.addRow method, when given a dictionary of column names/values then appears to pass it to the ReportClientHelper.getAsPayLoad method which proceeds to urlencode the data.

This then causes a 400 response with error code 8016.

An easy enough workaround for me has been to comment this line in the addRow method:

#payLoad = ReportClientHelper.getAsPayLoad([columnValues, config], None, None)

and below that add:

payLoad = columnValues

Essentially bypassing the urlencoding of the data.

Not sure if this causes any issues if using the addRow method in other ways. I am using it in it's basic form without any config values set.

timrichardson commented 4 years ago

thanks for this, I will investigate it.

timrichardson commented 4 years ago

It is a bug in the zoho library. The database row is being passed a payload to the POST request, but in fact the API is expecting the row to be passed as query parameters.

this works:

 def addRow(self, tableURI, columnValues, config=None):

        payLoad = ReportClientHelper.getAsPayLoad([columnValues, config], None, None)
        url = ReportClientHelper.addQueryParams(tableURI, self.token, "ADDROW", "XML")
        url += "&" + payLoad
        return self.__sendRequest(url, "POST", payLoad=None, action="ADDROW", callBackData=None)

I will fix this in my next upload

timrichardson commented 4 years ago

Closed in Pypi v 0.5.99