Erpnext hangs when calling python requests to external API

Dear Experts,

I created a custom method(image posted below) on server side which basically does a POST request to an external API using python module requests. So,for now i am calling this method using bench execute for testing purposes, i intend to call it within a doctype later on. The issue here is, while executing this method the entire erpnext hangs affecting all the logged in users until the control returns back. I am not sure as to how to fix this issue. Is there any way whereby the method call affects only the calling transaction instead of everybody else using the system. Appreciate your kind help.

Method:
image

if you can share some exceptions you might have captured while calling API

Hi @khushal_t,

Thankyou for the response.

No errors from the API hence no exceptions as of now. The API call genuinely takes little longer than a minute to reply back with data.