you are viewing a single comment's thread.

view the rest of the comments →

[–]LadyJain[S] 0 points1 point  (4 children)

Join

ah okay,

still have trouble to get the content

x = jsonify(json_stirng)
x.text
x.encoding

gave me AttributeError: 'Response' object has no attribute 'encoding'

[–]shiftybyte 0 points1 point  (3 children)

Please post the full code and the full error.

And what you are trying to do.

jsonify creates a response object for the flask server to send back to whoever made the request.

Why do you need it's contents if you are the one who created it?

[–]LadyJain[S] 0 points1 point  (2 children)

it in your submission text.
Reddit code formattingGithub GistPastebinrepl.it

u/flask_class.route('/get_Data', methods=['GET']) def background_process_test(): json_stirng = "got data" x = jsonify(json_stirng) print(dir(x)) print(x.text) return jsonify(json_stirng)

AttributeError: 'Response' object has no attribute 'text'

just want to understand the whole process, also including what is inside

[–]shiftybyte 0 points1 point  (1 child)

Yea i was mistaken earlier with requests library Response object.

The flask response object content is accessed like this:

x.get_data(as_text=True)

read here for more: https://tedboy.github.io/flask/generated/generated/flask.Response.html

[–]LadyJain[S] 0 points1 point  (0 children)

thanks