Infinite-Crafter-API-Wrapper project is designed to manage, store, and retrieve elements with unique properties and interactions. It supports JSON and SQLite storage mechanisms and provides a foundation for requesting and caching element data.
This project includes:
- An
Element
class that encapsulates the properties of an element, including its result, emoji representation, and newness status. - Abstract and concrete storage classes for persisting elements in JSON files and SQLite databases.
- A requester system for fetching element data, with a focus on extendibility towards asynchronous request handling.
- Python 3.11 or higher
- jsonpickle
- sqlite3 (included with Python standard library)
- aiohttp (for asynchronous request handling, optional)
To set up the project environment:
$ pip install jsonpickle aiohttp
- Initialize your storage:
from storage import JSONStorage, SQLiteStorage
json_storage = JSONStorage('path/to/your/file.json')
sqlite_storage = SQLiteStorage('path/to/your/database.db')
- Create and store elements:
from element import Element
element = Element({"result": "Water", "emoji": "💧", "isNew": "True"})
json_storage.store(element)
sqlite_storage.store(element)
- Load and save elements from/to storage:
json_storage.load()
sqlite_storage.load()
json_storage.save()
sqlite_storage.save()