The following is what I assume any professional Python developer is already well familiar with. However I’m usually familiar enough with the few packages I import for it not to be a problem. So it’s not something I’ve used in years.
I wanted to replace my account number create routine with the fake credit card number available in mimesis. By googling, I saw examples of it on the internet. However all the ways I tried failed. Supposedly credit_card_number(CardType…) was available as…
from mimesis import Person
person=Person()
ccn=person.credit_card_number(CardType…)
or…
from mimesis import Personel
personel=Personel()
ccn=personel.credit_card_number(CardType…)
Next I started guessing from what I knew…
from mimesis import Business
bus=Business()
ccn=bus.credit_card_number(CardType…)
I also tried Numbers like I did above with Business
All of these failed! I was just about to send an email asking for help, which I’d rather not do, if possible, when I remembered that Python has a way to expose their methods using “__dict__”. I had to google it…but I remembered!
import mimesis
for ls in mimesis.__dict__: print(ls)
I spotted Payment from that little bit of code…that’s probably it I thought! So from there I tried Payment…
from mimesis import Payment
for ls in Payment.__dict__: print(ls)
and I found it! So the solution (as of today) is…
from mimesis import Payment
pay=Payment()
ccn=pay.credit_card_number(CardType.VISA)