Convert unicode from API Endpoint (csv) to csv or jason or pydataset

I made a HTTP request to a CSV API Endpoint. I used
response = system.net.httpGet(url,'','','','',header)

and the response received is of 'unicode type.

type(response)
<type 'unicode'>

How can I convert it to a dataset?

It would be helpful to see what the response actually is.

But if it's a CSV, I would imagine it's just a long string with values separated by ',' and '\n' or similar to denote end of lines.

So you could split on '\n' to get the lines and then split on ',' to get the values.

But this is pure speculation unless we can see what the response actually is.

2 Likes

You can use Python's csv module to parse the CSV, then construct your dataset yourself:

https://docs.inductiveautomation.com/display/DOC81/system.dataset.toDataSet

2 Likes

It started off well, but I see this error

this helped.
No errors now.

Csv file import - Error: Cannot create PyString with non-byte value - #3 by PGriffith

I think I am set for now. I just need to convert it to dataset.