API Reference¶
anon.BaseAnonymizer¶
-
class
anon.
BaseAnonymizer
¶ -
clean
(obj)¶ Use this function if you need to update additional data that may rely on multiple fields, or if you need to update multiple fields at once
-
get_declarations
()¶ Returns ordered declarations. Any non-ordered declarations, for example any types that does not inherit from OrderedDeclaration will come first, as they are considered “raw” values and should not be affected by the order of other non-ordered declarations
-
get_queryset
()¶ Override this if you want to delimit the objects that should be affected by anonymization
-
patch_object
(obj)¶ Update object attributes with fake data provided by replacers
-
anon.lazy_attribute¶
-
anon.
lazy_attribute
(lazy_fn)¶ Returns LazyAttribute objects, that basically marks functions that should take obj as first parameter. This is useful when you need to take in consideration other values of obj
Example:
>>> full_name = lazy_attribute(o: o.first_name + o.last_name)
anon.fake_word¶
-
anon.
fake_word
(min_size=1, max_size=20)¶ Return fake word
Min_size: Minimum number of chars Max_size: Maximum number of chars Example:
>>> import django_anon as anon >>> print(anon.fake_word()) adipisci
anon.fake_text¶
-
anon.
fake_text
(max_size=255, max_diff_allowed=5, separator=' ')¶ Return fake text
Max_size: Maximum number of chars Max_diff_allowed: Maximum difference (fidelity) allowed, in chars number Separator: Word separator Example:
>>> print(anon.fake_text()) alias aliquam aliquid amet animi aperiam architecto asperiores aspernatur assumenda at atque aut autem beatae blanditiis commodi consectetur consequatur consequuntur corporis corrupti culpa cum cumque cupiditate debitis delectus deleniti deserunt dicta
anon.fake_small_text¶
-
anon.
fake_small_text
(max_size=50)¶ Preset for fake_text.
Max_size: Maximum number of chars Example:
>>> print(anon.fake_small_text()) Distinctio Dolor Dolore Dolorem Doloremque Dolores
anon.fake_name¶
-
anon.
fake_name
(max_size=15)¶ Preset for fake_text. Also returns capitalized words.
Max_size: Maximum number of chars Example:
>>> print(anon.fake_name()) Doloribus Ea
anon.fake_username¶
-
anon.
fake_username
(max_size=10, separator='')¶ Returns fake username
Max_size: Maximum number of chars Separator: Word separator Rand_range: Range to use when generating random number Example:
>>> print(anon.fake_username()) eius54455
anon.fake_email¶
-
anon.
fake_email
(max_size=40, suffix='@example.com')¶ Returns fake email address
Max_size: Maximum number of chars Suffix: Suffix to add to email addresses (including @) Example:
>>> print(anon.fake_email()) enim120238@example.com