I want to make my code Async for HTTP calls, since the whole program stops while the call is being made.
I took a look at grequests and couldn't figure it out, same for asyncio
this is the current sync version of the code:
myvar1 = class_object()response = requests.get(myvar1.url)if response.status_code == 200: myvar1.accept()
I would like to do the following instead:
def myfunction: request.get(myvar1.url,callbackfunction(response,myvar1)) return Nonedef callbackfunction(response,myvar1): if response.status_code == 200: myvar1.accept()
I can successfully pass a callback function to the request, the question is how to pass arguments to that callback.
Basically, the goal is to execute a method of the passed argument of the callback function.