A lightweight Python module that validates Australian phone numbers.
Project description
AUSnumtools
About
AUSnumtools is a lightweight Python module that validates Australian phone numbers.
How it works
The Australian Communications and Media Authority (ACMA) outlines the telephone numbering plan for Australia. Specifically, it details the format of a phone number, such as which groups of digits represent an area code or a mobile carrier. This module uses a RegEx pattern of valid Australian phone number ranges and returns a Boolean true or false value.
is_au_landline("0212345678")can be used to validate an Australian landline numberis_au_mobile("0412345678")can be used to validate an Australian mobile numberis_au_number("0812345678")can be used to validate an Australian landline or mobile number.
It can also consider fictional numbers designated by the ACMA to be invalid as of the v1.1.0 release of this module by setting the blockFiction parameter to True. By default, fictional numbers will not be invalidated.
However, please note that there are limitations to this type of validation:
- It cannot validate if the geographical code of a landline number does exist (These types of validation may be supported in a future release)
- It cannot validate "smartnumbers" such as 1800 XXX XXX, 1300 XXX XXX, and 13 XXXX numbers (These numbers may be supported in a future release)
Example
If 0412 345 678 is checked as an Australian mobile number:
print(ausnumtools.is_au_mobile("0412345678"))
The output would be True, as Australian mobile numbers begin with 04 followed by eight digits.
If (09) 1234 56789 is checked as an Australian landline number:
print(ausnumtools.is_au_landline("09123456789"))
The output would be False, as the 09 area code does not exist in Australia and is followed by more than eight digits.
If 0491 570 006 is checked as an Australian landline or mobile number and checked against the ACMA's designated fictional numbers:
print(ausnumtools.is_au_number("0491570006", blockFiction=True))
The output would be False, as this Australian mobile number is designated for fictional use by the ACMA and is therefore not available to subscribers.
Install
AUSnumtools is listed on the Python Package Index and can be download via Python's package manager, pip.
pip install ausnumtools
Then, the module can be imported into the desired Python script.
import ausnumtools
Alternatively, the module can be packaged and installed manually. Please consult Python's documentation for such instructions.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ausnumtools-1.1.1.tar.gz.
File metadata
- Download URL: ausnumtools-1.1.1.tar.gz
- Upload date:
- Size: 17.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c29f4dc5919e047ec9b39313a6b1aacd3220de618f31deddfc1ed42fdd0eb19
|
|
| MD5 |
49365e9850caf9fca9bfd4fc850dc68c
|
|
| BLAKE2b-256 |
84c604d98b9b18004f6a43284d38504078ab984fc9f44bd012cf0a7cd13791aa
|
File details
Details for the file ausnumtools-1.1.1-py3-none-any.whl.
File metadata
- Download URL: ausnumtools-1.1.1-py3-none-any.whl
- Upload date:
- Size: 19.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8935c111254500b556e449022bd5fa1ea4e4a1a7a79ce45c7b9de6802db9662
|
|
| MD5 |
37bacc201f79f89f7c64264d18c50ad7
|
|
| BLAKE2b-256 |
f8e2d64f4f4685cf3ef3e886968ea59e3cb4298940e411e40446ed7dcf62156b
|