WE'RE MOVING! USE THIS REPO INSTEAD: https://github.com/Xelvanta/Anndromeda-RoyaleAPI
This is a Quart API to fetch Royale High item names and their community values from Traderie.
- Python 3.x: Make sure you have Python 3.x installed. You can download it from python.org.
- pip: Ensure you have pip (Python package installer) installed. It usually comes with Python.
-
Clone the Repository:
git clone https://github.com/ProjectAnndromeda/royalehigh-api.git cd royalehigh-api -
Create a Virtual Environment (optional but recommended):
python -m venv venv
-
Activate the Virtual Environment:
-
Windows Command Prompt:
venv\Scripts\activate
-
Windows PowerShell:
.\venv\Scripts\Activate.ps1
-
macOS/Linux:
source venv/bin/activate
-
-
Install Dependencies:
pip install -r requirements.txt
-
Install Playwright Browsers:
After installing the dependencies, you need to install the necessary browser binaries for Playwright:
playwright install
-
Run the Quart Application:
quart run
-
Access the API:
Open Google Chrome or an API client (like Insomnia) and navigate to:
http://127.0.0.1:5000/items
[
{
"name": "14 Karat Gold Infinity Chain",
"value": 14000
},
{
"name": "2019 Party Hat",
"value": 10000
},
{
"name": "2020 Lunar Rat Ears",
"value": 4000
},
...
]The API may take some time to return data due to the process of scraping multiple pages. The script handles pagination and will stop once no more items are detected.
- Consideration: If you encounter timeouts in your API client, consider increasing the timeout settings for your requests. This adjustment will allow the application to handle longer processing times and improve overall stability during data retrieval.
The script captures item names and values from Traderie. It checks for the presence of a "no-items" message to determine if there are no more items to fetch.
- Consideration: Ensure that the page structure on Traderie has not changed, as the script relies on specific class names to find and extract data. If there are updates to the page structure, you might need to adjust the class names in the script.
-
Dependencies: Ensure that all required packages listed in
requirements.txtare installed. Use a virtual environment to manage these dependencies and avoid conflicts with other Python projects. -
Playwright Management: The script uses Playwright for browser automation. After installing the required packages, make sure to install the necessary browser binaries with
playwright install.
The script includes basic error handling and logging configurations. It is designed to handle common issues like network errors and timeouts, and to retry fetching pages if necessary.
- Consideration: Adjust logging levels and error handling according to your debugging needs. More granular error handling might be required based on specific use cases or to improve robustness.
If you use or modify this code, please include the following attribution in any related documentation or publicly accessible materials: "Powered by Anndromeda™ by Alina."
This code is provided under the terms of the LICENSE.txt file included in this distribution.