A utility to generate random Icelanders
Project description
Icelander generator
Icelander generator is a tool made to generate a bunch of icelanders.
Details
Icelander generator uses a list of male and female names scraped from is.wikipedia.org and the kennitala pypi package (https://pypi.org/project/kennitala/) to generate random people with proper icelandic names and kennitala. It can be very useful for testing purposes where a bunch of icelanders are required. Can also just be used for fun, I guess.
Installation
Inside your virtualenv run
$ pip install icelander-generator
Usage
Icelander
from icelander_generator import Icelander
icelander = Icelander()
# Generate a random person
icelander.get_random_person()
# Returns {
# 'ssn': '{random ssn}',
# 'gender': '{randomly selected gender},
# 'firstname': '{randomly selected first name based on gender}',
# 'lastname': '{randomly selected last name based on gender}',
# }
# Generate a woman born in 1981
icelander.get_random_person(gender='female', year=1981)
# Returns {
# 'ssn': '{random ssn from year 1981}',
# 'gender': 'female',
# 'firstname': '{randomly selected first name based on gender}',
# 'lastname': '{randomly selected last name based on gender}',
# }
# Return a list of randomly generated people of random age and gender
icelander.get_random_people(10)
# Return a list of randomly generated women born in 1981
icelander.get_random_people(10, gender='female', year=1981)
# Dump result from get_random_people to a json file
icelander.dump_random_people_to_file(filename='dump.json', num_people=10, gender='female', year='1981')
Address
from icelander_generator.address import Address
ad = Address()
# Get random address
ad.get_random_address()
# Get random address in Reykjavík
ad.get_random_address(place='Reykjavík')
# Get random address in 101 PO code
ad.get_random_address(po_code='101')
# Get random address, but only up to street number 23
ad.get_random_address(max_num=23)
Future ideas
- More gender options?
- Middle names
- Company generator
I'm also open for suggestions and pull requests on https://github.com/7oi/IcelanderGenerator
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file icelander_generator-0.3.2.tar.gz
.
File metadata
- Download URL: icelander_generator-0.3.2.tar.gz
- Upload date:
- Size: 88.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.7.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38f10fed3ab63dad4826d0b6883b3a4d025d8ee2ee6083d96e491a2702a4409c |
|
MD5 | 4c04e4ae9da97d605e334f399cbfa168 |
|
BLAKE2b-256 | 82f846ff3e2729c5fa13cbbed35b2d2ed8d2480fefe8605176c9a0586b42b2a2 |
File details
Details for the file icelander_generator-0.3.2-py3-none-any.whl
.
File metadata
- Download URL: icelander_generator-0.3.2-py3-none-any.whl
- Upload date:
- Size: 88.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.7.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59ac760f9e659844fcda746f74f8973bd9f6bfa08e7e95a1767480c04733c84d |
|
MD5 | 4d0d3c85f899f9436b82553288aa76a2 |
|
BLAKE2b-256 | d2800dc7308d12b1905106c0501aaeea79f25de6097fa4af8ac6d19b40013e4c |