An unofficial asynchronous Python library for xivapi.
Project description
Overview
xivapi2 is an unofficial asynchronous Python library for xivapi.
Installation
You can install this library using pip:
pip install xivapi2
Usage
Interacting with sheets
To get a list of sheets currently supported by xivapi, you can use the sheets method:
import asyncio
from xivapi2 import XivApiClient
async def main():
client = XivApiClient()
sheets = await client.sheets()
for sheet in sheets:
print(sheet)
asyncio.run(main())
To list what rows a specific sheet has, you can use the sheet_rows method:
import asyncio
from xivapi2 import XivApiClient
async def main():
client = XivApiClient()
async for row in client.sheet_rows("Item", fields=["Name", "Description"], limit=40):
print(f"ID: {row.row_id}, Name: {row.fields["Name"]}, Description: {row.fields["Description"]}")
asyncio.run(main())
To get detailed information on a specific row, you can use the get_sheet_row method:
import asyncio
from xivapi2 import XivApiClient
async def main():
client = XivApiClient()
row = await client.get_sheet_row("Item", 12056)
print(row.fields["Name"])
print(row.fields["Description"])
row = asyncio.run(main())
Searching
To search for data in a specific sheet, you can use the search method.
First, construct a search query using the QueryBuilder class.
import asyncio
from xivapi2 import XivApiClient, QueryBuilder, FilterGroup
query = (
QueryBuilder("Item")
.add_fields("Name", "Description")
.filter("IsUntradable", "=", False)
.filter(
FilterGroup()
.filter("Name", "~", "Gemdraught")
.filter("Name", "~", "Vitality", exclude=True)
)
.set_version(7.2)
.limit(100)
)
Then, pass the constructed query to the clients search method,
async def main(query):
client = XivApiClient()
async for result in client.search(query):
print(result.fields["Name"])
print(result.fields["Description"])
asyncio.run(main(query))
For information on other available methods, please refer to the documentation page: https://xivapi2.readthedocs.io/en/latest/
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 xivapi2-0.1.0b1.tar.gz.
File metadata
- Download URL: xivapi2-0.1.0b1.tar.gz
- Upload date:
- Size: 58.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1f4c74a9a128dce0fe70c7520c34ee24ce31f89c045e6bf2e20af9d73f8a3dc
|
|
| MD5 |
87c2f6bf09d05cd1ea77e9a746cab0f7
|
|
| BLAKE2b-256 |
0794c970d2df746f5cf442f49c21c8264b5ada263fa73bd97a81067208d792d8
|
File details
Details for the file xivapi2-0.1.0b1-py3-none-any.whl.
File metadata
- Download URL: xivapi2-0.1.0b1-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec8dbe8f192360e4c8c04d1a6a27e74c61172617a80dbe7f22c8031c14d0615c
|
|
| MD5 |
3b8ef5204e3f7caa30a49de610c4ecdb
|
|
| BLAKE2b-256 |
bf80a33329db031bfd331ac5e150516924db781c960c8385de738120d165956e
|