Skip to main content

Python API wrapper for Prosperous Universes community API FIO.

Project description

fio_wrapper - Prosperous Universe game data through FIO

PyPI - Version PyPI - Python Version License: MIT


FIO API wrapper with pydantic data validation and easy-to-use querying. fio_wrapper implements the most used endpoints of Prosperous Universes community game data API.

Endpoints

The following endpoints are available as classes of the wrapper:

# Planet
- /planet/{Planet}
- /planet/allplanets
- /planet/allplanets/full
- /planet/sites/{Planet}

# Material
- /material/{MaterialTicker}
- /material/allmaterials
- /material/category/{CategoryName}

# Building
- /building/{BuildingTicker}
- /building/allbuildings

# Recipe
- /recipes/{Ticker}
- /recipes/allrecipes

# Exchange
- /exchange/{ExchangeTicker}
- /exchange/all
- /exchange/full
- /exchange/orders/{CompanyCode}
- /exchange/orders/{CompanyCode}/{ExchangeCode}

# LocalMarket
- /localmarket/planet/{Planet}
- /localmarket/planet/{Planet}/{Type}
- /localmarket/shipping/source/{Planet}
- /localmarket/shipping/destination/{Planet}
- /localmarket/company/{Company}

Usage

Installation

pip install fio-wrapper

Access data

Creating the FIO adapter and looking for information about the material Drinking Water by its ticker "DW".

from fio_wrapper import FIO

fio = FIO()

material = fio.Material.get("DW")
print(material)
print(material.model_dump_json())

This will print the material information of Drinking Water as MaterialModel and it's JSON.

MaterialId='4fca6f5b5e6c3b8a1b887c6dc99db146' CategoryName='consumables (basic)' CategoryId='3f047ec3043bdd795fd7272d6be98799' Name='drinkingWater' Ticker='DW' Weight=0.10000000149011612 Volume=0.10000000149011612 UserNameSubmitted='SAGANAKI' Timestamp=datetime.datetime(2023, 10, 28, 19, 26, 21, 831707)
{
    "MaterialId": "4fca6f5b5e6c3b8a1b887c6dc99db146",
    "CategoryName": "consumables (basic)",
    "CategoryId": "3f047ec3043bdd795fd7272d6be98799",
    "Name": "drinkingWater",
    "Ticker": "DW",
    "Weight": 0.10000000149011612,
    "Volume": 0.10000000149011612,
    "UserNameSubmitted": "SAGANAKI",
    "Timestamp": "2023-10-28T19:26:21.831707"
}

Contributing

We welcome contributions of all types! In order to set up fio_wrapper locally please do the following:

  1. Install Python + Poetry
  2. Run the poetry environment and install depenencies
  3. We are aiming for 100% code coverage

Tests

fio_wrapper uses pytest, requests_mock and pytest-cov to run tests, mock calls towards FIO endpoints and generate the code coverage report and use black as formatter.

Run tests:

pytest 

Generate coverage report:

pytest --cov --cov-report=html:coverage --cov-config=.coveragerc

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

fio_wrapper-1.0.1.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

fio_wrapper-1.0.1-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file fio_wrapper-1.0.1.tar.gz.

File metadata

  • Download URL: fio_wrapper-1.0.1.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.12.0 Linux/6.2.0-1015-azure

File hashes

Hashes for fio_wrapper-1.0.1.tar.gz
Algorithm Hash digest
SHA256 7601bcd4d40149abd7a32b3ac4461ff9286b2483b9f56b1fee7bae85917cc744
MD5 4ddfa012134adff6e1dcc35bc4f78b37
BLAKE2b-256 269e28b123b94cbf9ed04532828e2cbdda04b394d43618d0e18af710066b3d00

See more details on using hashes here.

File details

Details for the file fio_wrapper-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: fio_wrapper-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.12.0 Linux/6.2.0-1015-azure

File hashes

Hashes for fio_wrapper-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5787570f5670e27b5d2622b7cd8fba2fa17ab53e4d08d1d0d3bad7fbec08bffc
MD5 d045c09a2245c14ddccea196d87d210b
BLAKE2b-256 56ea763fb8ca07db71b134becd5576c828641a4af35f83ddf1499618812c7d8f

See more details on using hashes here.

Supported by

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