Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xivapi2-0.1.0a1.tar.gz (56.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xivapi2-0.1.0a1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file xivapi2-0.1.0a1.tar.gz.

File metadata

  • Download URL: xivapi2-0.1.0a1.tar.gz
  • Upload date:
  • Size: 56.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for xivapi2-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 55f913b0fcf24472a920921432826310d6800970a7899411d907772cebed867b
MD5 e457350df8dc139a480e329182da0abf
BLAKE2b-256 9480ff5b93a51465ef3425f6594f1fdea5785028594a3212de33aa9ba27dff7e

See more details on using hashes here.

File details

Details for the file xivapi2-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: xivapi2-0.1.0a1-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

Hashes for xivapi2-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 6d9b4751de2b5279298fb8e4aa3d9fdf70a4bc3e1669ad522edcd7cbeb8573a7
MD5 547d133aacab2d4a4ba7d9ef0c8ae764
BLAKE2b-256 99b4676b8e51d636710fc4fc329997126e4c35b6ff6379dddf320ac66ab6b18d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page