Skip to main content

Official Python SDK for Globio

Project description

Globio Python SDK

The official Python SDK for Globio — game backend infrastructure built on Cloudflare.

PyPI version Python Version License: MIT


What is Globio?

Globio is a backend-as-a-service platform built specifically for game developers. Instead of stitching together Firebase, Supabase, PlayFab, and a handful of other services, you get everything in one SDK at one URL.

Module Service What it does
GlobioId Globio ID Authentication — email, OAuth, SMS, WhatsApp, anonymous
GlobioDoc GlobalDoc Document database — NoSQL, JSON documents
GlobioVault GlobalVault File storage — assets, avatars, replays, saves
GlobioPulse GlobalPulse Live config and feature flags
GlobioSync GlobalSync Real-time multiplayer rooms over WebSocket
GlobioSignal GlobalSignal Real-time notifications over WebSocket
GlobioMart GlobalMart Virtual economy — currencies, items, IAP
GlobioBrain GlobalBrain AI inference and content moderation
GlobioCode GlobalCode Serverless edge functions and hooks
GlobioScope GlobalScope Game analytics — events, funnels, retention

Installation

pip install globio

Requires Python 3.9 or higher.


Quick Start

The Python SDK is fully asynchronous, built on top of httpx and asyncio.

import asyncio
from globio.types import GlobioConfig
from globio.client import GlobioClient
from globio.modules.id import GlobioId

async def main():
    config = GlobioConfig(api_key="glo_client_your_key_here")
    client = GlobioClient(config)
    
    # Initialize the modules you need
    auth = GlobioId(client)
    
    # Use the services
    if not auth.is_signed_in():
        await auth.sign_in_anonymously()
        
    await client.close()

if __name__ == "__main__":
    asyncio.run(main())

Get your API key from the Globio Console.


Authentication — GlobioId

from globio.modules.id import GlobioId

auth = GlobioId(client)

# Sign up
result = await auth.sign_up(
    email="player@example.com", 
    password="securepassword"
)

# Sign in
result = await auth.sign_in("player@example.com", "securepassword")

# Get current user
user = await auth.get_user()

# Check if signed in
if auth.is_signed_in():
    print(f"Logged in as {user.display_name}")

# Update profile
await auth.update_profile({
    "display_name": "New Name",
    "avatar_url": "https://...",
    "metadata": {"level": 5, "clan": "dragons"}
})

# Sign out
await auth.sign_out()

Sessions are stored automatically and tokens are refreshed transparently in memory.


Documents — GlobioDoc

from globio.modules.doc import GlobioDoc

doc_db = GlobioDoc(client)

# Write a document
await doc_db.set("scores", user_id, {
    "score": 1500,
    "level": 12
})

# Read a document
result = await doc_db.get("scores", user_id)
print(result["data"]["score"]) # 1500

# Add a document (auto-generated ID)
await doc_db.add("game_sessions", {
    "player_id": user_id,
    "duration_seconds": 300,
    "map": "desert_storm"
})

# Query documents
results = await doc_db.query("scores", {
    "where": [{"field": "level", "op": ">=", "value": 10}],
    "orderBy": {"field": "score", "direction": "desc"},
    "limit": 10
})

# Delete a document
await doc_db.delete("scores", document_id)

File Storage — GlobioVault

from globio.modules.vault import GlobioVault

vault = GlobioVault(client)

# Upload a file
with open("avatar.png", "rb") as f:
    await vault.upload_file(f"avatars/{user_id}.png", f)

# List files in a path
files = await vault.list_files("avatars/")

# Get a public download URL
url = await vault.get_download_url("avatars/player.png")

# Delete a file
await vault.delete_file("avatars/old-avatar.png")

Live Config & Feature Flags — GlobioPulse

from globio.modules.pulse import GlobioPulse

pulse = GlobioPulse(client)

# Get all configs and flags at once
result = await pulse.get_all("production")
configs = result["data"]["configs"]
flags = result["data"]["flags"]

# Get a specific config value
max_players = await pulse.get_config("max_players")

# Check a feature flag
is_new_map_enabled = await pulse.evaluate_flag("new_map_feature")

if is_new_map_enabled:
    load_new_map()

Analytics — GlobioScope

from globio.modules.scope import GlobioScope

scope = GlobioScope(client)

# Track an event
await scope.track("level_completed", {
    "level": 5,
    "time_seconds": 120,
    "deaths": 2
})

await scope.track("item_purchased", {
    "sku": "sword_of_fire",
    "currency": "GEMS",
    "amount": 50
})

# Force-flush pending events immediately
await scope.flush()

Virtual Economy — GlobioMart

from globio.modules.mart import GlobioMart

mart = GlobioMart(client)

# Get player wallet (all currency balances)
wallet = await mart.get_wallet()
# -> [{"currency_code": "COINS", "balance": 500}, ...]

# Purchase an item
result = await mart.purchase("sword_of_fire", "GEMS")

# Get player inventory
inventory = await mart.get_inventory()

GlobioBrain — AI Agents and Moderation

GlobioBrain provides named AI agents with persistent conversation history and content moderation.

Chat with an Agent

from globio.modules.brain import GlobioBrain

brain = GlobioBrain(client)

# Simple chat — server manages conversation history
result = await brain.chat("support-agent", "How do I reset my password?")
print(result["data"]["response"])

Content Moderation

result = await brain.moderate(
    content="user submitted content here",
    content_type="chat_message"
)

if result["data"]["result"] == "rejected":
    # Block the content
    pass

GlobalCode — Serverless Functions

Invoke serverless HTTP functions directly from your Python backend.

from globio.modules.code import GlobioCode

code = GlobioCode(client)

# Invoke from server/client
result = await code.invoke("matchmaking", {
    "userId": "user_123",
    "rating": 1450,
    "region": "africa"
})

print(result["data"]["roomId"])

Error Handling

Every API call returns standard exceptions for different failure types.

from globio.exceptions import GlobioAuthError, GlobioValidationError

try:
    await auth.sign_in(email, password)
except GlobioAuthError as e:
    print(e.code)    # e.g., 'INVALID_CREDENTIALS'
    print(e.message) # e.g., 'Email or password is incorrect'
except GlobioValidationError as e:
    print("Invalid input format")

Type Hinting

The SDK is strictly typed and ships with full type annotations. All methods return strongly typed objects (defined in globio.types).


License

MIT © Globio Technologies

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

globio-0.1.0.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

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

globio-0.1.0-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

Details for the file globio-0.1.0.tar.gz.

File metadata

  • Download URL: globio-0.1.0.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for globio-0.1.0.tar.gz
Algorithm Hash digest
SHA256 42739fc96d05171c2fc16bd5b3e7de5f779e69e6e17ac87dd990525a6d8a6801
MD5 3c4cb63bca12a5644da5c3b75514c455
BLAKE2b-256 e7e489aad02b3c6fcb7c95273ff321ac9378c81b25a76fdd0bbb36194b5b3073

See more details on using hashes here.

Provenance

The following attestation bundles were made for globio-0.1.0.tar.gz:

Publisher: publish.yml on Globio-Technologies/globio-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file globio-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: globio-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for globio-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 88af247501150dde41dd1b8c1af3ec97d93c5f1dee5166352a3d71e47314dad1
MD5 574601c4b600d0001add3352e596d94a
BLAKE2b-256 4cf68be4a3444387171f1fefbb1c0ac224020ea7f89c63f2534f323aec81cc30

See more details on using hashes here.

Provenance

The following attestation bundles were made for globio-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Globio-Technologies/globio-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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