Skip to main content

A python wrapper for the Infinitode 2 API.

Project description

Infinitode.py

An asynchronous Python wrapper for the Infinitode-2 API using async-await syntax.


Installation

Install the library via pip:

pip install infinitode.py

Showcase

Setting Up a Session

Create a session to communicate with Rainy's API. Use the with statement to ensure the session closes properly. Alternatively you can can simply call Session.close() once you don't need it anymore.

import asyncio
import infinitode

async def main():
    async with infinitode.Session() as API:
        # Your API calls go here
        pass

asyncio.run(main())

Fetching Leaderboard Data

Parameters:

  • mapname: The map identifier (e.g., "5.1" or "4.b1" or "zecred").
  • playerid (sometimes optional): The player's unique identifier.
  • mode (optional): One of 'score', 'waves'. Defaults to 'score'.
  • difficulty (optional): One of 'EASY', 'NORMAL', 'ENDLESS_I'. Defaults to 'NORMAL'.

Player Score on a Specific Map

Retrieve the score of a specific player on a particular map.

score_5_1 = await API.leaderboards_rank(
    mapname="5.1",
    playerid="U-E9BP-FSN9-H6ENMQ",
    mode="score",
    difficulty="NORMAL"
)

Top 200 Leaderboard on a Specific Map

Retrieve the leaderboard of the top 200 wave scores on 5.1.

leaderboard_5_1 = await API.leaderboards(
    mapname=5.1,
    mode="waves"
)

Runtime Leaderboard

Fetch the leaderboard displayed during gameplay. This provides additional percentile information.

runtime_5_1 = await API.runtime_leaderboards(
    mapname=5.1,
    playerid="U-E9BP-FSN9-H6ENMQ",
    difficulty="ENDLESS_I"
)

Skill Point Leaderboard

Get the top 3 skill point owners. Optionally specify a playerid.

sp_leaderboard = await API.skill_point_leaderboard(
    playerid="U-E9BP-FSN9-H6ENMQ"
)

Daily Quest Leaderboard

Retrieve the top 200 players of today's daily quest or a specified date.

  • date: YYYY-MM-DD (string) or datetime.datetime.
dq_leaderboard = await API.daily_quest_leaderboards("2024-12-05")

Working with Leaderboards

A leaderboard is a sequence of scores with additional utility functions.

Access Score and Leaderboard Attributes

Leaderboards always have these attributes:

  • mapname, mode, difficulty, total

And optionally these:

  • date, season, player (will return a score object)

Scores always have these attributes:

  • playerid, rank, score, mapname, mode, difficulty

And optionally these:

  • has_pfp, level, nickname, pinned_badge, position, top, total, player (will return a Player object if fetched beforehand)

Example for printing attributes, scores, and leaderboards

for score in leaderboard_5_1:
    print(score.nickname)
    score.print_score()  # Helper method

leaderboard_5_1.print_scores()

Slice a Leaderboard

Retrieve a subset of the leaderboard:

top_1 = leaderboard_5_1[0]
top_10 = leaderboard_5_1[0:10]
print(len(top_10))

Player Information

Fetch Player Data

Retrieve detailed player information.

player = await API.player("U-E9BP-FSN9-H6ENMQ")

Attributes include:

  • playerid, nickname, level, xp, season_level, total_score, and many more.

Get Player Scores

Use the score method to access specific map scores.

player.score(5.1).print_score()

Fetch Daily Quest and Skill Point Scores

Use additional API calls to retrieve daily quest and skill point scores:

await player.fetch_daily_quest(API)
await player.fetch_skill_point(API)

print(player.daily_quest.rank, player.skill_point.score)

Beta Scores

Almost all API calls support an additional beta boolean parameter. This will make a request to the beta servers instead. No guarantees for it working.

leaderboard_5_1 = await API.leaderboards(mapname=5.1, mode='waves', beta=True)

Logging

Set up logging to monitor requests and responses.

  • INFO: Logs every request.
  • DEBUG: Logs server responses.
import infinitode
import asyncio
import logging

logging.basicConfig(level=logging.INFO)

async def main():
    async with infinitode.Session() as API:
        await API.leaderboards("6.3")

asyncio.run(main())

Notes

  • Some data (e.g., seasonal leaderboard, players) require additional parsing and will take longer to process.
  • Do not abuse this API wrapper for any kind of malicious action.

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

infinitode.py-1.1.6.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

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

infinitode.py-1.1.6-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file infinitode.py-1.1.6.tar.gz.

File metadata

  • Download URL: infinitode.py-1.1.6.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.1

File hashes

Hashes for infinitode.py-1.1.6.tar.gz
Algorithm Hash digest
SHA256 1757db99a809edee6370804a0790e34aab81088a5c866eea531217f64020bf64
MD5 19b626945328052bba99d0e652fedc57
BLAKE2b-256 30a6cded24fc8eb1fbc406ed382d021f8a085014738fc3b1ae3e61315747cc0c

See more details on using hashes here.

File details

Details for the file infinitode.py-1.1.6-py3-none-any.whl.

File metadata

  • Download URL: infinitode.py-1.1.6-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.1

File hashes

Hashes for infinitode.py-1.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 4cb1b7e7bd9c6475424c45a2f876a9de12d482499eec65219c17acf541bae15a
MD5 69d045989fe0f818ebbf8d60c43d753c
BLAKE2b-256 4091cc5281b3fd57a28c8a8382a1e9b18b05819cfb15135e55e045d454b5d55f

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