Skip to content

Instantly share code, notes, and snippets.

View dkhmelenko's full-sized avatar

Dmytro Khmelenko dkhmelenko

View GitHub Profile
@dkhmelenko
dkhmelenko / decorator_usage.py
Last active September 20, 2023 08:46
Decorator usage
@authenticate(user)
def get_employees():
...
get_employees()
@dkhmelenko
dkhmelenko / decorator_declaration.py
Last active September 20, 2023 08:48
Decorator with arguments
def authenticate(request):
def decorator(*args, **kwargs):
add_auth_headers()
request(*args, **kwargs)
def add_auth_headers():
...
return decorator
@dkhmelenko
dkhmelenko / decorators_chain.py
Created September 19, 2023 07:57
Decorators chaining
@authenticate
@log_request
def get_employees(user):
...