Reputation: 90
I have a Requests response object, r. r gets passed into a callback function as an argument. I want to perform an action on r.text, and then return the full r object.
However, when I try to reassign r.text,
AttributeError: can't set attribute
is thrown
Upvotes: 0
Views: 118
Reputation: 8524
The text
attribute is a propery
without setter.
If you want to modify it, you should copy it to a new variable like this:
from copy import copy
my_text = copy(r.text)
Upvotes: 1