mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 17:47:02 +03:00
c5518e0ec3
+ Add providers class diagram
17 lines
554 B
Python
17 lines
554 B
Python
"""`Callable` providers with keyword arguments example."""
|
|
|
|
import passlib.hash
|
|
|
|
import dependency_injector.providers as providers
|
|
|
|
|
|
# Password hasher and verifier providers:
|
|
password_hasher = providers.Callable(passlib.hash.sha256_crypt.encrypt,
|
|
salt_size=16,
|
|
rounds=10000)
|
|
password_verifier = providers.Callable(passlib.hash.sha256_crypt.verify)
|
|
|
|
# Making some asserts:
|
|
hashed_password = password_hasher('super secret')
|
|
assert password_verifier('super secret', hashed_password)
|