HistoricDataRequest in python: "from" parameter is recognized as a keyword instead of keyword-argument

Hello,

I have an issue getting HistoricDataRequest class to work, because the "from" parameter is recognized as a keyword(as in "from x import y") in python and will give "Unexpected expression" error as a result.

Documentation says to use _from as parameter, but that is not what the class expects and will therefore raise a error during runtime that the parameter is missing the "from" argument.

All I have found so far is that the class is generated by https://openapi-generator.tech, has anyone actually used this or got it to work in python? So far I have only seen some few threads regarding this class from people who are also not getting the class to work, with no response...

Documentation: iot-client-py/docs/apis/tags/SeriesV2Api.md at master · arduino/iot-client-py · GitHub

It feels a bit silly that "from" being recognized as a keyword is what would cause the class to not function. It sounds like something the interpreter would manage? Is it an interpreter issue? Currently I use python 3.10.11

Hi @daddethebad. I found a workaround here:

The example code with that adjustment:

    body = HistoricDataRequest(
        **{"from": "1970-01-01T00:00:00.00Z"},
        properties=[
            "properties_example"
        ],
        to="1970-01-01T00:00:00.00Z",
    )
1 Like

Thank you, this solved the issue!

You are welcome. I'm glad it is working now.

Regards,
Per

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.