Skip to content

Python Code from Console not working #124

@cmiuser

Description

@cmiuser

Trying to create a kube cluster from API in Python. So I ran the command from the API Console and picked the Python code being generated.
But at the time of testing it, once authenticated, the code to call the post command seems to be incorrect:

result = client.post('/cloud/project/<serviceID>/kube', 
    ='{"name":"test1","nodepool":{"antiAffinity":false,"autoscale":false,"desiredNodes":1,"flavorName":"d2-4","monthlyBilled":false,"name":"nodepool1"},"privateNetworkId":"A-private-network-id","region":"DE1","updatePolicy":"NEVER_UPDATE","version":"1.26"}', // Request Body (type: cloud.ProjectKubeCreation)
)

In fact, the code seems syntactically incorrect. I made this fix:

result = client.post('/cloud/project/<serviceID>/kube', 
    '{"name":"test1","nodepool":{"antiAffinity":false,"autoscale":false,"desiredNodes":1,"flavorName":"d2-4","monthlyBilled":false,"name":"nodepool1"},"privateNetworkId":"A-private-network-id","region":"DE1","updatePolicy":"NEVER_UPDATE","version":"1.26"}' )

And now at least is tried to run, but fires an exception "The input that you provided isn't valid JSON or not well formatted".
I've also tried to build a dict with all the parameters, then dump it into json format, but same error appeared.

It seems the code generated by the console is not ok.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions