Add a format payload function to the payload module

This commit is contained in:
Thomas S Hatch 2011-03-07 14:52:55 -07:00
parent 2a12f05b1c
commit 6833289132

View file

@ -20,3 +20,15 @@ def unpackage(package):
'''
return pickle.loads(package)
def format_payload(enc, cmd, **kwargs):
'''
Pass in the required arguments for a payload, the enc type and the cmd,
then a list of keyword args to generate the body of the load dict.
'''
payload = {'enc': enc}
load = {'cmd': cmd}
for key in kwargs:
load[key: kwargs[key]]
payload['load'] = load
return payload