Skip to main content

A simple Python wrapper for the unofficial Infinite Craft API.

Project description

infcraft

A simple and lightweight Python wrapper for the unofficial infiniteback.org API, used for the game Infinite Craft.

Installation

Install the package directly from PyPI:

pip install infcraft

Usage

The module provides a single function, pair, which takes two elements and returns the crafted result.

import infcraft

try:
    # Combine two elements
    result = infcraft.pair("Water", "Fire")
    
    if result:
        print(f"Result: {result.name}")
        print(f"Emoji: {result.emoji}")

    # Example 2
    steam = infcraft.pair("Water", "Fire")
    engine = infcraft.pair(steam.name, "Fire")
    
    if engine:
        print(f"Crafted '{engine.name}' {engine.emoji}")

except infcraft.InfCraftError as e:
    print(f"An API error occurred: {e}")

The pair function returns a CraftResult object which has two attributes: .name and .emoji.

Error Handling

The module will raise an infcraft.InfCraftError if there is a network problem, an HTTP error status code, or if the API returns an invalid response.

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

infcraft-1.0.0.tar.gz (1.8 kB view details)

Uploaded Source

Built Distribution

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

infcraft-1.0.0-py3-none-any.whl (2.3 kB view details)

Uploaded Python 3

File details

Details for the file infcraft-1.0.0.tar.gz.

File metadata

  • Download URL: infcraft-1.0.0.tar.gz
  • Upload date:
  • Size: 1.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for infcraft-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c23a3cef491b1ad6475e7a0da5cd4e3764bf7182c178ee861d416643cd8530d6
MD5 9edec43f1b85279b2a7093721118d89a
BLAKE2b-256 df01935b917b00a910f0540d52f03aaa97c5e6ec2a18f7ecb94299521cf87fea

See more details on using hashes here.

File details

Details for the file infcraft-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: infcraft-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 2.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for infcraft-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b381c1e05a42c8a9ac3df5c97b170a4444d44649c541d113dafdc3f2ec37811
MD5 35c574a8c75fe20a1f8f1e2b88427bad
BLAKE2b-256 510d65009bc33275665e4b793ed5a2327063d9a24a5a3d7c8af896f7289485a3

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