TypeError: 'ImmutableMultiDict' objects are immutable python

Viewed 13570

Hi I'm trying to add a new key value pair but I'm receiving an error of TypeError: 'ImmutableMultiDict' objects are immutable the variable I'm trying to add a new key came from a request.form but I can't add a new key value. Any idea on how to achieve this?

Here is my code on my controller

@benefits_api.route("/templates", methods=["POST"])
def store():

    parameters = request.form
    response = BenefitTemplateService.create(parameters)

    return jsonify(response), response['code']

and my service is like this

class BenefitTemplateService(object):

    @staticmethod
    def create(params):
        # some validation here

        params['credit_behavior'] = "none"
        return params

But I'm getting an error on the assignment for credit_behavior below is the error message

enter image description here

1 Answers
Related