You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
flask use gevent.monky makes advanced_mode is true #1254
I'm calling both methods to get the issue and user.
Getting user returns <Response [200]> not a json.
I traced the source code. then I found in rest_client.py
defget(
self,
path,
data=None,
flags=None,
params=None,
headers=None,
not_json_response=None,
trailing=None,
absolute=False,
advanced_mode=False,
):
""" Get request based on the python-requests module. You can override headers, and also, get not json response :param path: :param data: :param flags: :param params: :param headers: :param not_json_response: OPTIONAL: For get content from raw request's packet :param trailing: OPTIONAL: for wrap slash symbol in the end of string :param absolute: bool, OPTIONAL: Do not prefix url, url is absolute :param advanced_mode: bool, OPTIONAL: Return the raw response :return: """response=self.request(
"GET",
path=path,
flags=flags,
params=params,
data=data,
headers=headers,
trailing=trailing,
absolute=absolute,
advanced_mode=advanced_mode,
)
print(self.advanced_mode) # Trueprint(advanced_mode) # Falseifself.advanced_modeoradvanced_mode:
returnresponseifnot_json_response:
returnresponse.contentelse:
ifnotresponse.text:
returnNonetry:
returnresponse.json()
exceptExceptionase:
log.error(e)
returnresponse.text
self.advanced_mode is True, so return is raw format, not json
if I don't use monkey.patch_all, then self.advanced_mode = False
Is this a bug? How do I return the json format, I didn't find a way to set the self.advanced_mode
Activity
gonchik commentedon Oct 3, 2023
Hi!
as I see we have to check the following expression
if self.advanced_mode:
instead a full one
zystudios commentedon Oct 10, 2023
thanks,
I'm guessing that monkey.patch_all made the function execution at the same time, causing self.advanced_mode not to change in time