pythonpostpycurlopencpu

Unparsable argument: 5PL getting this error while trying to post the file through pycurl in python


I am trying to post a file and a couple of arguments to a function at the given URL. But I am getting an error (Unparsable argument: 5PL). Can anyone help to fix this error?

import pycurl

c = pycurl.Curl()

values = [
     ("infile", (pycurl.FORM_FILE, "5pl.csv")),
     ("model","5PL"),
     ("log", "F")
]

c.setopt(c.URL, "http://granitepoint.ocpu.io/dose-response-R/R/readData")
c.setopt(c.HTTPPOST, values)
c.perform()
c.close()

Solution

  • OpenCPU POST parameters must either be JSON objects or R syntax. You are posing parameter value 5PL which is neither of those.

    If you want to post a string value "5PL" you post e.g. ("model","'5PL'")