International phone number generation
Project description
Phone Gen
International phone number generation
This module was created exclusively for generating test data
Installation
Install using pip with
pip install phone-gen
Example
from phone_gen import PhoneNumber
phone_number = PhoneNumber("GB")
# Get a phone number
number = phone_number.get_number()
print(number) # +442908124840
# Get a country code
country_code = phone_number.get_code()
print(country_code) # 44
# Get a phone number without a country code
number = phone_number.get_number(full=False)
print(number) # 183782623
pytest fixture
import pytest
from phone_gen import PhoneNumber
@pytest.fixture
def phone_number():
def wrap(code):
return PhoneNumber(code).get_number()
yield wrap
def test_one(phone_number):
number = phone_number("DE")
...
Using the CLI
usage: phone-gen [-h] [-v] [-n] country
International phone number generation
positional arguments:
country Country code example: GB
optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-n, --not-full Get a phone number without a country code
Example
# Get a phone number
$ phone-gen GB
+44199561679
# Get a phone number without a country code
$ phone-gen GB -n
199561343
Resources
- Google's libphonenumber
- Modified strgen library
Contributing
Contributions are very welcome.
Changelog
- 1.1.1 Updating patterns to libphonenumber v8.12.4
- 1.1.0 Added cli
- 1.0.0 The first stable release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for phone_gen-1.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0adc4b692ed09199d7aa27a7269fe621b50d4541f118c52805c2247de0baf60f |
|
MD5 | 163035838757012dc74bc762c8b27427 |
|
BLAKE2b-256 | 422d4a1fe11fc94d3dd4bad8de627f16fea29045b93587cee3a466c8423407f5 |