views
21
likes
2

Comments

What do you think?
No comments yet.
Name Your Price

Gamejolt API Python

Version: 1.0.03 days ago
Gamejolt API

GameJolt API - Python Wrapper free (Pay what you want) & open-source

A Python wrapper for the GameJolt API that provides an easy-to-use interface for managing game data, scores, and user interactions.

Features

  • User Authentication: Verify user credentials and manage sessions

  • Global Data Store: Store and retrieve game-wide data (leaderboards, settings, etc.)

  • User Data Store: Save and load user-specific data (progress, achievements, etc.)

  • Score System: Add, fetch, and manage scores with customizable tables

  • User Management: Fetch user profiles and friend lists

Installation

  1. download the files

  2. Install the required dependencies:

		
			pip install -r requirements.txt
		
	

Configuration

Before using the API, you need to obtain your GameJolt credentials:

  1. Go to your game page

  2. Navigate to Manage Game → Game API → API Settings

  3. Copy your Game ID and Private Key

Quick Start

		
			 
from GamejoltAPI import GameJoltSession

# Initialize the session with your GameJolt credentials
GAME_ID = 123456  # Replace with your Game ID
SECRET = "your_secret_key"  # Replace with your Private Key

gj = GameJoltSession(game_id=GAME_ID, private_key=SECRET)

# Login a user
username = "player_username"
user_token = "user_token"

if gj.login(username, user_token):
    print(f"Welcome {username}!")
    
    # Set user data
    gj.set_user_data(username, user_token, "level", 5)
    
    # Add a score
    gj.add_score(score_str="1500", sort_value=1500, username=username, user_token=user_token)
    
    # Fetch scores
    top_scores = gj.fetch_scores(limit=10)
    print(f"Top scores: {top_scores}")
else:
    print("Login failed!")
		
	

All functions included :

Authentication

  • login(username: str, user_token: str) -> bool - Verify user credentials

Global Data Store

  • fetch_global_data(key: str) -> Any - Retrieve global data by key

  • set_global_data(key: str, value: Any) -> Dict - Set global data

  • update_global_data(key: str, value: Any, operation: str) -> Dict - Update numeric data

  • remove_global_data(key: str) -> Dict - Remove global data

  • get_keys_global_data(pattern: str = None) -> List[str] - List all keys

User Data Store

  • set_user_data(username, user_token, key, value) -> Dict - Set user data

  • fetch_user_data(username, user_token, key) -> Any - Fetch user data

  • update_user_data(username, user_token, key, value, operation) -> Dict - Update user data

  • remove_user_data(username, user_token, key) -> Dict - Remove user data

  • get_keys_user_data(username, user_token, pattern) -> List[str] - List user keys

Score System

  • add_score(score_str, sort_value, username, user_token, guest, table_id, extra_data) -> Dict

  • fetch_scores(limit, table_id, username, user_token) -> List[Dict]

  • get_tables() -> List[Dict] - Get score tables

  • get_rank(sort_value, table_id) -> int - Get rank for a score

User Management

  • fetch_user(username, user_id) -> Dict - Get user info

  • get_friends(username, user_token) -> List[int] - Get friend IDs

  • fetch_friends_profile(username, user_token) -> List[Dict] - Get friends' profiles

Running the Test Suite

The project includes a comprehensive test suite in test_api.py:

		
			 
# Update credentials in test_api.py first 
python test_api.py
		
	

Project Structure

		
			 
API/
├── GamejoltAPI.py      # Main API wrapper
├── test_api.py         # Test suite and examples
├── requirements.txt    # Python dependencies
└── README.md          # This file
		
	

Requirements

  • Python 3.6+

  • requests library

License

This project is provided as-is for use with the GameJolt API.

Support

If you find a bug or something send me a message on Gamejolt page !

#api #help #other



all-ages
Nothing has been posted to this project page yet. Check back later!