Generating SSN
#1687
Replies: 1 comment 3 replies
|
Builtin providers where removed in 19.0.0. We've added "Custom Field Handlers". You can register from mimesis import Field, Locale
field = Field(Locale.EN)
@field.handle("ssn")
def ssn(random, **kwargs) -> str:
"""Generate a random, but valid SSN.
:returns: SSN.
:Example:
569-66-5801
"""
area = random.randint(1, 899)
if area == 666:
area = 665
return "{:03}-{:02}-{:04}".format(
area,
random.randint(1, 99),
random.randint(1, 9999),
)
field('ssn')
Output: '887-79-0715' |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The new release (19.0.0) removed the USASpecProvider, which helped me generate SSN (social security number).
Is this not possible anymore?
All reactions