Skip to main content

A Python library for fetching player data from the Enka Network API.

Project description

Endfield

A Python library for fetching and parsing player data from the Enka Network API for Endfield.

PyPI version License

Overview

Endfield is an async Python library that provides easy access to player game data from the Enka Network API. It allows developers to retrieve comprehensive information about players, their characters, weapons, equipment, and computed statistics.

Features

  • Async Support: Built with asyncio for efficient concurrent requests
  • Complete Data Models: Pydantic-based models for type-safe data handling
  • Player Showcase Data: Fetch player profiles and their character showcases
  • Character Information: Get detailed character data including skills, talents, and stats
  • Equipment & Weapons: Access equipment and weapon information
  • Stat Computation: Calculate final character statistics with modifiers
  • Asset Resolution: Built-in asset resolution with local JSON data
  • Update Checking: Check for and download library updates
  • Session Management: Flexible session handling with context managers

Installation

From PyPI

pip install endfield-py

From GitHub

pip install git+https://github.com/MR-LORD-REX/endfield.git

Manual Installation

git clone https://github.com/MR-LORD-REX/endfield.git
cd endfield
pip install -e .

Requirements

  • Python 3.8+
  • aiohttp >= 3.8.0
  • pydantic >= 2.0.0

Quick Start

Basic Usage

import asyncio
from endfield import Endfield

async def main():
    async with Endfield() as client:
        # Fetch player showcase data
        showcase = await client.get_showcase(uid=4225399080)
        print(showcase)

asyncio.run(main())

Enable Debug Logging

async with Endfield(debug=True) as client:
    showcase = await client.get_showcase(uid=4225399080)

API Reference

Endfield Client

Constructor

Endfield(
    session: Optional[aiohttp.ClientSession] = None,
    debug: bool = False
)

Parameters:

  • session: Optional external aiohttp session
  • debug: Enable debug logging (default: False)

Methods

get_showcase(uid: int | str)

Fetch complete player showcase data including all characters, equipment, and weapons.

showcase = await client.get_showcase(uid=4225399080)

Returns: ShowcaseData - Complete player showcase information with all characters

get_character_showcase(uid: int | str, index: int = 0)

Fetch detailed data for a specific character in the player's showcase.

char_data = await client.get_character_showcase(uid=4225399080, index=0)

Parameters:

  • uid: Player UID
  • index: Character index (0-based, default: 0)

Returns: CharacterData - Detailed character data including skills, talents, and computed statistics

get_profile(uid: int | str)

Fetch player profile information only.

profile = await client.get_profile(uid=4225399080)

Returns: PlayerProfile - Player account and character list information

check_for_updates()

Check for library updates.

await client.check_for_updates()
close()

Close the client session.

await client.close()

Data Models

The library provides comprehensive Pydantic models for type-safe data handling:

  • ShowcaseData: Complete player showcase information
  • PlayerProfile: Player account information
  • ProfileCharacter: Character showcase data
  • CharacterData: Detailed character information including skills and talents
  • WeaponData: Weapon information and skills
  • EquipData: Equipment data with stat modifiers
  • ComputedStats: Final calculated character statistics

Examples

Fetch Player Profile

async with Endfield() as client:
    showcase = await client.get_showcase(uid="your_uid_here")
    profile = showcase.player_info
    print(f"Player: {profile.player_name}")
    print(f"Level: {profile.level}")

Get Character Information

async with Endfield() as client:
    showcase = await client.get_showcase(uid="your_uid_here")
    for char in showcase.characters:
        print(f"Character: {char.name}")
        print(f"Level: {char.level}")
        print(f"Stats: {char.stats}")

Check Weapon Information

async with Endfield() as client:
    showcase = await client.get_showcase(uid="your_uid_here")
    for char in showcase.characters:
        if char.weapon:
            print(f"{char.name}'s Weapon: {char.weapon.name}")
            print(f"Level: {char.weapon.level}")

Error Handling

The library provides specific exceptions for error handling:

from endfield.errors import APIError, CharacterNotFoundError, WeaponNotFoundError

try:
    async with Endfield() as client:
        showcase = await client.get_showcase(uid="invalid_uid")
except APIError as e:
    print(f"API Error: {e}")
except CharacterNotFoundError as e:
    print(f"Character not found: {e}")
except WeaponNotFoundError as e:
    print(f"Weapon not found: {e}")

Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues on the GitHub repository.

Development Setup

git clone https://github.com/MR-LORD-REX/endfield.git
cd endfield
pip install -e .

License

This project is licensed under the MIT License - see the LICENSE.txt file for details.

Disclaimer

This is an unofficial library. Endfield is a trademark of their respective owners. This library is not affiliated with or endorsed by the game developers. Use this library responsibly and in accordance with the Enka Network API terms of service.

Support

For issues, questions, or suggestions, please open an issue on the GitHub repository.

Credits

Changelog

Version 1.0.6

  • Added medals data to player profile
  • Updated data models to include medals
  • Improved error handling for character processing

NOTE

  • Computation of final character stats are done by the currently known formulas, some of them might be inaccurate , feel free to contribute if you encounter any discrepancies or have suggestions for improvement.

Happy Endfielding

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

endfield_py-1.0.6.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

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

endfield_py-1.0.6-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file endfield_py-1.0.6.tar.gz.

File metadata

  • Download URL: endfield_py-1.0.6.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.10

File hashes

Hashes for endfield_py-1.0.6.tar.gz
Algorithm Hash digest
SHA256 fd6eae23402b9e4e5124c982f573b28b50071b3edbc11bdcb71dbc2f8bd3a108
MD5 1a966c50870239be6d5eaa11f7ab0a38
BLAKE2b-256 ef9e61814359bbe12f37957ca95078c16991f5fcf04587fa6081c0e44ca22454

See more details on using hashes here.

File details

Details for the file endfield_py-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: endfield_py-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 22.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.10

File hashes

Hashes for endfield_py-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b55c600803a1b538685573ed5d56262156a3ad5ab94578edb26bc8348d0c5255
MD5 c11406f5e73c93652d819c2ed3112883
BLAKE2b-256 e1062c43a6244529a5d8c825ceac48c889b9d85bf8358c6c5e7f5a3e285766ad

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