In general built-in types do not allow setting attributes no them. If you try with list, tuple etc. If you are using python3.3+ you can use types.SimpleNamespace to have objects where you can set attributes. (By the way: I don't understand why the OP used setattr at all. If you have a fixed attribute name you can just do: req = object(); req.member1 = 'value1').
list,tupleetc. If you are using python3.3+ you can usetypes.SimpleNamespaceto have objects where you can set attributes. (By the way: I don't understand why the OP usedsetattrat all. If you have a fixed attribute name you can just do:req = object(); req.member1 = 'value1').