(post_data)
convert x_www_form_urlencoded data to dict

    Args:
        post_data (str): a=1&b=2

    Returns:
        dict: {"a":1, "b":2}
convert x_www_form_urlencoded data to dict
convert x_www_form_urlencoded data to dict
def convert_x_www_form_urlencoded_to_dict(post_data):
    """ convert x_www_form_urlencoded data to dict

    Args:
        post_data (str): a=1&b=2

    Returns:
        dict: {"a":1, "b":2}

    """
    if isinstance(post_data, str):
        converted_dict = {}
        for k_v in post_data.split("&"):
            try:
                key, value = k_v.split("=")
            except ValueError:
                raise Exception(
                    "Invalid x_www_form_urlencoded data format: {}".format(post_data)
                )
            converted_dict[key] = unquote(value)
        return converted_dict
    else:
        return post_data
def convert_x_www_form_urlencoded_to_dict ( post_data ) : if isinstance ( post_data , str ) : converted_dict = { } for k_v in post_data . split ( "&" ) : try : key , value = k_v . split ( "=" ) except ValueError : raise Exception ( "Invalid x_www_form_urlencoded data format: {}" . format ( post_data ) ) converted_dict [ key ] = unquote ( value ) return converted_dict else : return post_data