Async Python client for XIVAPI for Final Fantasy XIV
Project description
xivapy
An async python client for accessing XIVAPI data for Final Fantasy XIV.
Features
- Custom model support powered by pydantic
- Async python
- Type hints throughout for pleasant developer experience
- All major endpoints of xivapi covered
Installation
pip install xivapy
Quick Start
The easiest way to use the client is to define a model and try looking through a sheet with a search.
import xivapy
class ContentFinderCondition(xivapy.Model):
# Custom map a python field to an xivapi field name
id: xivapy.QueryField[int] = xivapy.QueryField(FieldMapping('row_id'))
# compress language fields into a dictionary for easy viewing
# for this, however, you'll need to set up a default dict for it to use
# The output of this is:
# {
# 'en': "The Protector and the Destroyer",
# 'de': "Schützer des Volkes, Schlächter des Volkes",
# 'fr': "Protecteurs et destructeurs",
# 'ja': "護る者、壊す者"
# }
# Optional languages will be omitted
name: xivapy.QueryField[xivapy.LangDict] = xivapy.QueryField(FieldMapping('Name', languages=['en', 'de', 'fr', 'ja']))
# get a deeply nested (and optional) field lifted up into a top-level field
bgm_file: xivapy.QueryField[str | None] = xivapy.QueryField(xivapy.FieldMapping('Content.BGM.File'))
# by default, the sheet to be searched will be the name of the model
# if you wish to override this, set the following:
#__sheetname__ = 'SomeOtherSheetName'
async with xivapy.Client() as client:
# Search ContentFinderCondition for all content that mentor roulette applies to
async for content in client.search(ContentFinderCondition, query=xivapy.QueryBuilder().where(MentorRoulette=1)):
# Data is typed as SearchResult[ContentFinderCondition], accessable by the `.data` field
print(f'{content.data.name.get('en', 'No English Name')} ({content.data.id}) - {content.data.bgm_file}')
# The same thing, but for a single id:
result = await client.sheet(ContentFinderCondition, row=998)
if result is not None:
# result is a ContentFinderCondition instance
print(result)
# You can also search for multiple ids:
async for result in client.sheet(ContentFinderCondition, rows=[1, 3, 99, 128]):
# result is of type ContentFinderCondition
print(result)
API Reference
You can see the docs at https://macrocosmos-app.github.io/xivapy
Development
The only real prerequisite you need is uv; afterwards:
git clone https://github.com/macrocosmos-app/xivapyuv sync --locked
Afterwards, you should be able to develop against the library or use it with uv run python in a shell (for example) - it's an editable package inside the virtual environment.
Code quality
To ensure code quality, install the pre-commit hooks with:
uv run pre-commit install --install-hooks
This ensures that commits follow a baseline quality and typing standard. This project uses ruff for formatting and checking (see docs); configure your formatter or use uv run ruff format ... as appropriate for your environment.
For typing, this project uses mypy; you can check with uv run mypy for a basic check, though the pre-commit hooks have a few extra flags.
Testing and coverage
You can run the existing tests (and get coverage) with
uv run coverage run -m pytest
uv run coverage report
License
MIT License - see LICENSE file
Links
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 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 xivapy-0.5.0.tar.gz.
File metadata
- Download URL: xivapy-0.5.0.tar.gz
- Upload date:
- Size: 60.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efabf035cdbff64a186b01dfe38d830164b73c45be7602302354370afd8d880e
|
|
| MD5 |
5d2ff511ea92d92723f7825c3f890ff7
|
|
| BLAKE2b-256 |
6cf3fb2a04846206ac3642085667b68b888640c0217ef3ae49478e293cf5993f
|
Provenance
The following attestation bundles were made for xivapy-0.5.0.tar.gz:
Publisher:
publish.yml on macrocosmos-app/xivapy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xivapy-0.5.0.tar.gz -
Subject digest:
efabf035cdbff64a186b01dfe38d830164b73c45be7602302354370afd8d880e - Sigstore transparency entry: 471216021
- Sigstore integration time:
-
Permalink:
macrocosmos-app/xivapy@5512b1d8ed6ede83990e5ec1a29e0e39db00bf4f -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/macrocosmos-app
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5512b1d8ed6ede83990e5ec1a29e0e39db00bf4f -
Trigger Event:
push
-
Statement type:
File details
Details for the file xivapy-0.5.0-py3-none-any.whl.
File metadata
- Download URL: xivapy-0.5.0-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c406407f7cb48edeafe9fb1779cef1ff33c5cc5c21ce00e869c88ad1288b0d3
|
|
| MD5 |
5794ad3b3f3d5000a7cb69f19cf31ace
|
|
| BLAKE2b-256 |
d413a30d8e4a5afedd099a6e47fbf817535079f5eaae3254dbbc2c278a8afe9c
|
Provenance
The following attestation bundles were made for xivapy-0.5.0-py3-none-any.whl:
Publisher:
publish.yml on macrocosmos-app/xivapy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xivapy-0.5.0-py3-none-any.whl -
Subject digest:
4c406407f7cb48edeafe9fb1779cef1ff33c5cc5c21ce00e869c88ad1288b0d3 - Sigstore transparency entry: 471216064
- Sigstore integration time:
-
Permalink:
macrocosmos-app/xivapy@5512b1d8ed6ede83990e5ec1a29e0e39db00bf4f -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/macrocosmos-app
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5512b1d8ed6ede83990e5ec1a29e0e39db00bf4f -
Trigger Event:
push
-
Statement type: