Advertisement
Mochinov

Untitled

Nov 21st, 2022
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1.  
  2. class AsyncProtectProcessing:
  3.  
  4. def __init__(self) -> None:
  5. pass
  6.  
  7. def foo(async_function):
  8. async def wrapper(*args, **kwargs):
  9. cls, data = args
  10. cls.user = "some_data"
  11. return await async_function(*args, **kwargs)
  12. return wrapper
  13.  
  14.  
  15. class ScrapingTasks(HTTPEndpoint):
  16.  
  17. @AsyncProtectProcessing.foo
  18. async def get(self, request: Request) -> JSONResponse:
  19. print(self.user)
  20. return JSONResponse("asdasdas")
  21.  
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement