Skip to main content

An unofficial asynchronous Python library for the Universalis API.

Project description

Overview

xivuniversalis is an unofficial asynchronous Python library for the Universalis REST API.

Important

This library is still in development and is not guaranteed to be stable or feature-complete.

Installation

You can install this library using pip:

pip install xivuniversalis

Usage

A common use case for the Universalis API is looking up item listings. This can be done with the UniversalisClient.get_listings method,

import asyncio
from xivuniversalis import UniversalisClient

client = UniversalisClient()
results = asyncio.run(client.get_listings(4, "crystal"))
print(f"Found {len(results.active_listings)} listings")
for listing in results.active_listings:
    print(f"[{listing.world_name}] {listing.quantity}x{listing.price_per_unit}/each ({listing.total_price} gil total)")

You must have the item ID’s for the items you wish to look up.

If you need a source to obtain these from, you can use a service such as xivapi.

You can also use the UniversalisClient.get_market_data method to find an item’s cheapest listing, average price, and other useful metrics.

import asyncio
from xivuniversalis import UniversalisClient

client = UniversalisClient()
market_data = asyncio.run(client.get_market_data(12056, "north-america"))
print(f"[{market_data.nq.lowest_price.region_world_id}] Found listing for {market_data.nq.lowest_price.by_region} gil")
print(f"Average listing price is {market_data.nq.average_price.by_region} gil")

You may have noticed above that we are referencing a world ID instead of a world name.

For endpoints where world names are not available, you can use the libraries UniversalisClient.get_worlds method to build a dictionary mapping that will allow you to easily convert world ID’s back into human-readable world names.

import asyncio
from xivuniversalis import UniversalisClient

client = UniversalisClient()
worlds = asyncio.run(client.get_worlds())
world_id = 37
print(worlds[world_id].name)

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

xivuniversalis-0.1.0a2.tar.gz (64.2 kB view details)

Uploaded Source

Built Distribution

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

xivuniversalis-0.1.0a2-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file xivuniversalis-0.1.0a2.tar.gz.

File metadata

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

File hashes

Hashes for xivuniversalis-0.1.0a2.tar.gz
Algorithm Hash digest
SHA256 6cfcb16d5a38f194d803a00a23dfba83e636c9fa6d80b98d843f3e803e5f4e6e
MD5 2cc29667dcb49e752036446a6164fb26
BLAKE2b-256 9e9aab4ab0bd40b857d3402905560b46f078bd9eeda972ca503db6d6439f42fa

See more details on using hashes here.

File details

Details for the file xivuniversalis-0.1.0a2-py3-none-any.whl.

File metadata

File hashes

Hashes for xivuniversalis-0.1.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 11452e5c5b78eb92b2e922d625ec37d9a7b60177a90a3373ae8b128f16474f00
MD5 9ea8fd1b88290f767a55696df1d78015
BLAKE2b-256 c6fd517c8ecbc9153ebd08c6ae83d4cbea1219c2146dbe0ff3e891740bf1e410

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