Metadata-Version: 2.5
Name: ix-locations-api
Version: 0.0.0.dev38855854536
Summary: Python client for the Infoxchange Locations API, generated from its OpenAPI schema.
Project-URL: Repository, https://github.com/InfoxchangeTS/locations-api
Author-email: IX Developers <devs@infoxchange.net.au>
Requires-Python: >=3.11
Requires-Dist: attrs>=22.2.0
Requires-Dist: httpx<0.29.0,>=0.23.1
Description-Content-Type: text/markdown

# Infoxchange Locations API Python client

A Python client for the [Infoxchange Locations API](https://github.com/InfoxchangeTS/locations-api), generated from its OpenAPI schema with [openapi-python-client](https://github.com/openapi-generators/openapi-python-client).

Requires Python 3.11+.

## Installation

```sh
pip install ix-locations-api
```

## Usage

Each API operation is a module under `ix_locations_api.api` with `sync`, `sync_detailed`, `asyncio` and `asyncio_detailed` functions. The `*_detailed` versions return the full response including the status code, the others return just the parsed body (or `None` if the request wasn't successful).

```python
from ix_locations_api import AuthenticatedClient
from ix_locations_api.api.search import search_suburbs_list

client = AuthenticatedClient(base_url="https://locations-api.dev.ixapps.org", token="<access token>")

page = search_suburbs_list.sync(client=client, search="Abbotsford", state="VIC")
for suburb in page.results:
    print(suburb.name, suburb.postcode, suburb.centroid)
```

To get an access token with a username and password:

```python
from ix_locations_api import AuthenticatedClient, Client
from ix_locations_api.api.token import token_create
from ix_locations_api.models import TokenObtainPairRequest

tokens = token_create.sync(
    client=Client(base_url="https://locations-api.dev.ixapps.org"),
    body=TokenObtainPairRequest(username="...", password="..."),
)
client = AuthenticatedClient(base_url="https://locations-api.dev.ixapps.org", token=tokens.access)
```

The API documentation is available on the home page of the API (e.g. https://locations-api.dev.ixapps.org/).

## Development

The `ix_locations_api` package is generated from [`openapi.yaml`](../../openapi.yaml) at the root of this repo and isn't committed. To generate it and build the package:

```sh
./generate.sh
uv build
```

New versions are published to PyPI automatically when a release is tagged.
