Developer Q&A

Ask a Question
Back to All

How to create a WorkZone using Python 3 + zeep

(edited)

Do you happen to have sample code using Python which creates a workzone?

I following the workzone example here but in python: https://developer.corrigo.com/docs/work-order-c

According to the documentation "During Work Zone creation, globally configured Work Zone defaults (listed in the table) can be leveraged by setting the command attributes AssetTemplateId and SkipDefaultSettings to 0 and false respectively."

But that's not happening for me. I'm getting errors which indicates that the default settings are not being applied to the workzone. Below is my sample code (some lines omitted for brevity)

from zeep import Client

workzone_type = client.get_type('ns1:WorkZone')

wz = workzone_type(DisplayAs="sbm_workzone_1", Number=1, WoNumberPrefix="sbm", TimeZone=1, Id=1, PerformDeletion=False)
wzc_cmd = client.get_type('ns1:WorkZoneCreateCommand')

cmd = wzc_cmd(WorkZone=wz, AssetTemplateId=0, SkipDefaultSettings=False)

print(client.service.Execute(cmd))

The error I am getting is:

Missing element ConcurrencyId (Execute.commandRequest.WorkZone.ConcurrencyId)

It's asking me to explicitly set the ConcurrencyId of the WorkZone which I thought would be from the default values.

Any advice?

Thanks!