abn-lookup-service
A python client to interact with ABN Lookup services
This library provides a Python interface to the Australian Business Register (ABR) XML Search API. All API methods are based on the official ABR documentation.
Installation
python3 -m pip install 'abn-lookup-service @ git+https://github.com/tmck-code/abn-lookup-service'
Authentication
You'll need an ABN Lookup GUID from the Australian Business Register. Set it as an environment variable:
export ABN_LOOKUP_GUID="your-guid-here"
CLI
The package includes a command-line interface:
# Search by ABN
abn-lookup-service abn --abn 53004085616
# Search by name
abn-lookup-service name --name "Telstra" --state "VIC" --limit 5
# Search by postcode
abn-lookup-service postcode --postcode "3000" --state "VIC"
# Advanced name search
abn-lookup-service name-advanced --name "Commonwealth Bank" --state "NSW" --legalName "Y"
Run with --help to see all available commands and options:
abn-lookup-service --help
Example help output
usage: lookup.py [-h] {abn-status,charity,registration-event,update-event,name,abn,asic,postcode,name-advanced} ...
ABN Lookup Client
positional arguments:
{abn-status,charity,registration-event,update-event,name,abn,asic,postcode,name-advanced}
abn-status Search by ABN status
charity Search by charity
registration-event Search by registration event
update-event Search by update event
name Search by name
abn Search by ABN
asic Search by ASIC
postcode Search by postcode
name-advanced Advanced search by name
options:
-h, --help show this help message and exit
abn-lookup-service name --help
Example help output for 'name' command
usage: lookup.py name [-h] --name NAME --state {NSW,ACT,VIC,QLD,SA,WA,TAS,NT} [--limit LIMIT]
options:
-h, --help show this help message and exit
--name NAME Name to search for
--state {NSW,ACT,VIC,QLD,SA,WA,TAS,NT}
State to filter results by
--limit LIMIT Maximum number of results to return
Usage
Python Library
Basic Example
from abn_lookup_service.lookup import ABNLookupClient
import os
# Initialize the client
client = ABNLookupClient(authentication_guid=os.environ['ABN_LOOKUP_GUID'])
# Search by ABN
for result in client.search_by_abn('53004085616'):
print(result)
# Search by business name
for result in client.search_by_name(name='Telstra', state='VIC'):
print(result)
# {"ABN": {"identifierValue": "53653884756", "identifierStatus": "Active"}, "mainName": {"organisationName": "MOONTH MOTORS PTY LTD", "score": "98", "isCurrentIndicator": "Y"}, "mainBusinessPhysicalAddress": {"stateCode": "VIC", "postcode": "3031", "isCurrentIndicator": "Y"}}
# ...
Advanced Example
from abn_lookup_service.lookup import ABNLookupClient
import os
client = ABNLookupClient(authentication_guid=os.environ['ABN_LOOKUP_GUID'])
# Advanced name search with filters
results = client.search_by_name_advanced(
name='Commonwealth Bank',
state='NSW',
legalName='Y',
minimumScore=80,
maxSearchResults=10
)
for result in results:
# Access result fields
abn = result.get('ABN', {}).get('identifierValue')
name = result.get('mainName', {}).get('organisationName')
print(f"ABN: {abn}, Name: {name}")
# ABN: 48045546848, Name: COMMONWEALTH BANK OF AUSTRALIA
# ABN: 53004085616, Name: COMMONWEALTH BANK OF AUSTRALIA
# ...
Supported Methods
SearchByABN (docs)
Search for an entity by ABN.
Parameters:
abn(str, required): The ABN to search forincludeHistoricalDetails(str, optional): 'Y' or 'N' (default: 'N')
SearchByASIC (docs)
Search for an entity by ASIC number (ACN, ARBN, ARSN, ARFN).
Parameters:
asic(str, required): The ASIC number to search forincludeHistoricalDetails(str, optional): 'Y' or 'N' (default: 'N')
SearchByName (docs)
Search for entities by name (simple protocol).
Parameters:
name(str, required): Name to search forpostcode(str, optional): Filter by postcodelegalName(str, optional): 'Y' to search legal names onlybusinessName(str, optional): 'Y' to search business names onlytradingName(str, optional): 'Y' to search trading names onlystate(str, optional): Filter by state (NSW, ACT, VIC, QLD, SA, WA, TAS, NT)
SearchByNameAdvanced (docs)
Advanced search for entities by name with additional filters.
Parameters:
name(str, required): Name to search forpostcode(str, optional): Filter by postcodelegalName(str, optional): 'Y' to search legal names onlybusinessName(str, optional): 'Y' to search business names onlytradingName(str, optional): 'Y' to search trading names onlystate(str, optional): Filter by statesearchWidth(str, optional): Search width (narrow, typical, wide)minimumScore(int, optional): Minimum matching score (0-100)maxSearchResults(int, optional): Maximum number of results to returnactiveABNsOnly(str, optional): 'Y' to return only active ABNs
SearchByPostcode (docs)
Search for entities by postcode.
Parameters:
postcode(str, required): The postcode to search for
SearchByABNStatus (docs)
Search for entities by ABN status.
Parameters:
postcode(str, optional): Filter by postcodeactiveABNsOnly(str, optional): 'Y' to return only active ABNscurrentGSTRegistrationOnly(str, optional): 'Y' to return only GST registered entitiesentityTypeCode(str, optional): Filter by entity type code
SearchByUpdateEvent (docs)
Search for entities by update event.
Parameters:
updatedate(str, required): Update date (YYYY-MM-DD format)postcode(str, optional): Filter by postcodestate(str, optional): Filter by stateentityTypeCode(str, optional): Filter by entity type code
SearchByRegistrationEvent (docs)
Search for entities by registration event.
Parameters:
month(str, required): Month (1-12)year(str, required): Year (YYYY format)postcode(str, optional): Filter by postcodestate(str, optional): Filter by stateentityTypeCode(str, optional): Filter by entity type code
SearchByCharity (docs)
Search for charities.
Parameters:
postcode(str, optional): Filter by postcodestate(str, optional): Filter by statecharityTypeCode(str, optional): Filter by charity type codeconcessionTypeCode(str, optional): Filter by concession type code
Development
This doc section is for developers contributing to the project.
Testing
Docker
Build the docker image
docker build -f test/Dockerfile -t abn-lookup-service .
Run the tests with
docker run \
-it \
-v "$PWD":/app \
abn-lookup-service:latest \
bash -c 'pytest -vv test'
Host Machine
uv sync --all-groups
. .venv/bin/activate
pytest -vv -s test/
Metadata
Release files for abn-lookup-service 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| abn_lookup_service-0.2.0.tar.gz | 12.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| abn_lookup_service-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.6 kB
Release files / abn_lookup_service-0.2.0.tar.gz
| Download URL | abn_lookup_service-0.2.0.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
18ba9c4bc65eb94442a91c696c46e2c486578cb9bd4148dc24829866b27f3bfe
|
|
BLAKE2b-256 checksum How to use checksums |
3225d4aee64ccb971fab0b5c418687681cfb11a7b46b7d98c04aea70136117aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / abn_lookup_service-0.2.0-py3-none-any.whl
| Download URL | abn_lookup_service-0.2.0-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c606ab4742e985ec1e4824051bb810bc6722bf933abb663f120316981fde46e9
|
|
BLAKE2b-256 checksum How to use checksums |
a0a24890f521e5d9205a693bdde7709fa9f58b430fc192736c6309518cc9adef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for abn-lookup-service 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.