We have cwrap.py in demo/, ratc/, and tools/.., three copies of basically the same file. same story for pwrap.py. The demo and ratc versions are copy-pastes of each other with one line different.
The bigger problem: demo/ and ratc/ both POST to http://www.controlcore.org/pm/{yuyu}{apikey} plaintext HTTP with the API key sitting in the URL. tools/ was updated to https at some point but nobody backported it
Also pwrap.py was never properly cleaned up when cwrap.py was cwrap got context managers and specific exceptions, pwrap still has bare open() calls leaking handles every loop iteration and bare except: everywhere catching KeyboardInterrupt.
One more: if the first POST comes back empty (len(r.text)==0), variable t is never assigned but while oldt==t runs right after that's a NameError waiting to happen.
These six files should be one shared module with cwrap/pwrap as thin wrappers around it.