python use the string as not string -
this question has answer here: how access object attribute given string corresponding name of attribute 2 answers i url this response.url i more date response. i wonder if there way in can pass things want , use in response this: x = 'url' return response.x you can use getattr : x = "url" return getattr(response, x) from docs: getattr(object, name[, default]) return value of named attribute of object. name must string. if string name of 1 of object’s attributes, result value of attribute. example, getattr(x, 'foobar') equivalent x.foobar . if named attribute not exist, default returned if provided, otherwise attributeerror raised.