mixcoatl/utils.py
def format_dict(thedict, payload_format):
    """Format a dictionary into json, xml, or csv and return a string

    :param dict thedict: dictionary to be formatted
    :param str payload_format: the format to return either "json", "xml", or "csv"
    :returns str: formatted string
    """


    if payload_format == "json":
        return json.dumps(thedict, indent=4, sort_keys=True)
    elif payload_format == "xml":
        return "%s %s %s"% ('<?xml version="1.0" ?><root>',
                            xmltodict.unparse({"item":thedict}, full_document=False),
                            '</root>')
    elif payload_format == "csv":
        return to_csv([thedict])
    else:
        raise ValueError("Unknown format requested, use payload_format json, xml, csv")
Format a dictionary into json, xml, or csv and return a string

    :param dict thedict: dictionary to be formatted
    :param str payload_format: the format to return either "json", "xml", or "csv"
    :returns str: formatted string
    
Format a dictionary into json, xml, or csv and return a string
Format a dictionary into json xml or csv and return a string
def format_dict(thedict, payload_format):
    if payload_format == "json":
        return json.dumps(thedict, indent=4, sort_keys=True)
    elif payload_format == "xml":
        return "%s %s %s"% ('<?xml version="1.0" ?><root>',
                            xmltodict.unparse({"item":thedict}, full_document=False),
                            '</root>')
    elif payload_format == "csv":
        return to_csv([thedict])
    else:
        raise ValueError("Unknown format requested, use payload_format json, xml, csv")
def format_dict ( thedict , payload_format ) : if payload_format == "json" : return json . dumps ( thedict , indent = 4 , sort_keys = True ) elif payload_format == "xml" : return "%s %s %s" % ( '<?xml version="1.0" ?><root>' , xmltodict . unparse ( { "item" : thedict } , full_document = False ) , '</root>' ) elif payload_format == "csv" : return to_csv ( [ thedict ] ) else : raise ValueError ( "Unknown format requested, use payload_format json, xml, csv" )
Format a dictionary into json, xml, or csv and return a string
Format a dictionary into json xml or csv and return a string
"""Format a dictionary into json, xml, or csv and return a string

    :param dict thedict: dictionary to be formatted
    :param str payload_format: the format to return either "json", "xml", or "csv"
    :returns str: formatted string
    """
None
str
thedict
dictionary to be formatted
dictionary to be formatted
payload_format
the format to return either "json", "xml", or "csv"
the format to return either " json " " xml " or " csv "