Is there a way to generate a blank response object with all the attributes, or do I have to create the class myself?
I just want something for a flask app that is cleaner than doing something like this:
class fake_request():
status_code = None
text = None
response = fake_request()
I'm not sure I fully understand, but what's wrong with
from flask import Response
response = Response()
?
Flask documentation - Response object
If you're referring to generating an instance of an object inline, you can use this syntax
response = type('obj', (object,), {'status_code' : None, 'text' : None})
Update User added flask reference after this answer, leaving for reference
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With