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_smartnum("1800123456")can be used to validate an Australian smart numberis_au_number("0812345678")can be used to validate any Australian phone 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 if the mobile number is in a range associated with a specific mobile carrier (These types of validation may be supported in a future release)
- It cannot validate if the mobile number is connected to a specific mobile carrier (Mobile number porting makes this difficult to determine with certainty)
- It cannot validate if the phone number is allocated to a or belongs to the subscriber (Only the phone carrier can determine this with certainty, however a callback or SMS verification is typically enough for most cases)
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 1300 655 506 is checked as an Australian smart number:
print(ausnumtools.is_au_smartnum("1300655506"))
The output would be True, as 1300 smart numbers are followed by six 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.
Metadata
Release files for ausnumtools 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ausnumtools-1.2.1.tar.gz | 18.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ausnumtools-1.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.7 kB
Release files / ausnumtools-1.2.1.tar.gz
| Download URL | ausnumtools-1.2.1.tar.gz |
|---|---|
| Size | 18.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5988032aaab09b47ee884bb3de6bbf3917381aa7fc8246843d344f81662d8a69
|
|
BLAKE2b-256 checksum How to use checksums |
0829df9aebc830694640aff6d7858fac78acfab10ffa32461193b15913f2956b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Release files / ausnumtools-1.2.1-py3-none-any.whl
| Download URL | ausnumtools-1.2.1-py3-none-any.whl |
|---|---|
| Size | 19.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
62a53c223ed49bd17b688d838caf046ba09ce6edd2eb7689e4ac984fecafd697
|
|
BLAKE2b-256 checksum How to use checksums |
36b3aba3dc307ceaff2a8e67526d6947a6dd7043d426b2dee49e6e1359084345
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|