Hi and welcome to Digi Forum.
You can find some python example for WR31 here: https://github.com/digidotcom/transport_examples/tree/master/WR31
If nothing apply to your case, I would suggest you to open a case sending an email email@example.com.
Please also review Digi Support level options, in particular for code debugging/writing: https://www.digi.com/support.
Digi Technical Support Team