Une API REST publique et gratuite qui retourne toutes les informations sur un jeu vidéo en utilisant uniquement son nom.
-
Recherche unifiée : Un seul endpoint pour obtenir toutes les infos d'un jeu
-
Sources multiples : RAWG API, CheapShark, Steam Store API
-
Cache intelligent : SQLite avec TTL de 1 heure pour limiter les requêtes externes
-
Rate limiting : Protection contre les abus
-
Documentation interactive : Swagger UI automatique
-
Déploiement gratuit : Railway, Render ou serveur local
-
Nom, description, date de sortie
-
Développeur, éditeur
-
Genres, tags, catégories
-
Notes (Metacritic, RAWG)
-
Images (cover, screenshots)
-
Prix sur Steam, Epic Games Store, GOG
-
Prix normaux vs prix soldés
-
Pourcentage de réduction
-
Meilleur prix historique
-
Configuration système requise
-
Plateformes supportées
-
Steam App ID
-
Python 3.11+
-
pip
- Cloner le projet
git clone <votre repo>
cd gamelookup-api
- Installer les dépendances
pip install -r requirements.txt
- Configurer les variables d'environnement (optionnel)
Créer un fichier .env :
RAWG_API_KEY=votre_cle_rawg_ici
ENVIRONMENT=development
DEBUG=true
Pour obtenir une clé RAWG gratuite : https://rawg.io/apidocs
Note : Si aucune clé n'est fournie, une clé de démo sera utilisée automatiquement.
- Lancer l'API
uvicorn main:app --reload
L'API sera accessible sur http://localhost:8000
Une fois l'API lancée, accédez à :
-
Swagger UI : http://localhost:8000/docs
-
ReDoc : http://localhost:8000/redoc
Récupère toutes les informations d'un jeu par son nom.
| Paramètre | Type | Requis | Description |
|-----------|------|--------|-------------|
| game_name | string | Oui | Nom du jeu (path parameter) |
curl -X GET "http://localhost:8000/api/game/The%20Witcher%203"
-H "accept: application/json"
{
"success": true,
"data": {
"name": "The Witcher 3: Wild Hunt",
"slug": "the-witcher-3-wild-hunt",
"description": "The Witcher 3: Wild Hunt is an action role-playing game...",
"release_date": "2015-05-19",
"metacritic_rating": 92,
"rawg_rating": 4.66,
"rawg_ratings_count": 15234,
"genres": ["Action", "RPG"],
"platforms": ["PC", "PlayStation 4", "Xbox One", "Nintendo Switch"],
"developers": ["CD PROJEKT RED"],
"publishers": ["CD PROJEKT RED"],
"tags": ["RPG", "Open World", "Story Rich", "Fantasy"],
"cover_image": "https://media.rawg.io/media/games/618/618c2031a07bbff6b4f611f10b6bcdbc.jpg",
"screenshots": [
"https://media.rawg.io/media/screenshots/...",
"https://media.rawg.io/media/screenshots/..."
],
"pricing": {
"steam": {
"appid": "292030",
"current_price_usd": 39.99,
"current_price_cad": 53.99,
"on_sale": false,
"discount_percent": 0
},
"epic": {
"current_price": 39.99,
"normal_price": 39.99,
"on_sale": false,
"discount_percent": 0
},
"gog": {
"current_price": 39.99,
"normal_price": 39.99,
"on_sale": false,
"discount_percent": 0
},
"best_deal": {
"store": "Steam",
"price": 39.99,
"discount": 0,
"historical_low": 9.99
}
},
"system_requirements": {
"minimum": {
"os": "64-bit Windows 7, 64-bit Windows 8 (8.1)",
"processor": "Intel CPU Core i5-2500K 3.3GHz / AMD A10-5800K",
"memory": "6 GB RAM",
"graphics": "Nvidia GPU GeForce GTX 660 / AMD Radeon HD 7870",
"storage": "40 GB available space"
},
"recommended": {
"os": "64-bit Windows 10",
"processor": "Intel Core i7-3770 3.4 GHz / AMD FX-8350 4 GHz",
"memory": "8 GB RAM",
"graphics": "Nvidia GTX 770 / AMD Radeon R9 290",
"storage": "40 GB available space"
}
},
"website": "https://thewitcher.com",
"cached": false,
"cache_expires_at": "2024-03-22T15:30:00Z"
},
"timestamp": "2024-03-22T14:30:00Z"
}
{
"success": false,
"error": {
"code": "GAME_NOT_FOUND",
"message": "Aucun jeu trouvé avec le nom 'JeuInexistant'"
},
"timestamp": "2024-03-22T14:30:00Z"
}
Vérifier l'état de santé de l'API.
curl -X GET "http://localhost:8000/api/health"
-H "accept: application/json"
{
"status": "healthy",
"version": "1.0.0",
"database": "connected",
"cache_entries": 42,
"uptime_seconds": 3600
}
Obtenir des statistiques sur l'utilisation de l'API.
curl -X GET "http://localhost:8000/api/stats"
-H "accept: application/json"
{
"total_requests": 1523,
"cache_hits": 987,
"cache_misses": 536,
"cache_hit_rate": 64.8,
"total_games_cached": 312,
"active_cache_entries": 156,
"expired_cache_entries": 156
}
Vider tout le cache (nécessite authentification en production).
curl -X DELETE "http://localhost:8000/api/cache/clear"
-H "accept: application/json"
{
"success": true,
"message": "Cache vidé avec succès",
"entries_deleted": 312
}
- Pusher le code sur GitHub
git init
git add .
git commit -m "Initial commit"
git remote add origin <votre-repo-github>
git push -u origin main
-
Créer un compte Railway : https://railway.app
-
Nouveau projet
-
Cliquer sur "New Project"
-
Sélectionner "Deploy from GitHub repo"
-
Autoriser Railway à accéder à votre repo
-
- Sélectionner le repository
- Configuration automatique
-
Railway détecte automatiquement le
requirements.txt -
Build et déploiement automatiques
- Ajouter les variables d'environnement (optionnel)
-
Dans le dashboard Railway → Variables
-
Ajouter
RAWG_API_KEYavec votre clé RAWG
- Générer un domaine public
-
Settings → Generate Domain
-
Votre API sera accessible sur
https://votre-app.up.railway.app
# Installer Railway CLI
npm i -g @railway/cli
# Login
railway login
# Initialiser le projet
railway init
# Déployer
railway up
# Ajouter une variable d'environnement
railway variables set RAWG_API_KEY=votre_cle_ici
# Obtenir l'URL publique
railway domain
-
Créer un compte Render : https://render.com
-
Nouveau Web Service
-
Dashboard → New → Web Service
-
Connecter votre repo GitHub
- Configuration
-
Name : gamelookup-api
-
Environment : Python 3
-
Build Command :
pip install -r requirements.txt -
Start Command :
uvicorn main:app --host 0.0.0.0 --port $PORT
- Variables d'environnement (optionnel)
- Ajouter
RAWG_API_KEY
- Déployer
-
Cliquer sur "Create Web Service"
-
L'API sera accessible sur
https://votre-app.onrender.com
L'API implémente un rate limiting pour éviter les abus :
-
60 requêtes par minute par IP
-
En cas de dépassement : HTTP 429 (Too Many Requests)
{
"success": false,
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Trop de requêtes. Limite : 60 requêtes par minute.",
"retry_after": 45
},
"timestamp": "2024-03-22T14:30:00Z"
}
-
Durée : 1 heure par jeu
-
Stockage : SQLite
-
Invalidation : Automatique après expiration
-
Nettoyage : Automatique toutes les 6 heures
# Jeux populaires
curl "http://localhost:8000/api/game/Elden%20Ring"
curl "http://localhost:8000/api/game/Cyberpunk%202077"
curl "http://localhost:8000/api/game/God%20of%20War"
curl "http://localhost:8000/api/game/Red%20Dead%20Redemption%202"
# Jeux indépendants
curl "http://localhost:8000/api/game/Hades"
curl "http://localhost:8000/api/game/Celeste"
curl "http://localhost:8000/api/game/Hollow%20Knight"
# Jeux avec caractères spéciaux
curl "http://localhost:8000/api/game/Portal%202"
curl "http://localhost:8000/api/game/Half-Life%202"
| Code | Description |
|------|-------------|
| GAME_NOT_FOUND | Aucun jeu trouvé avec ce nom |
| RATE_LIMIT_EXCEEDED | Limite de requêtes dépassée |
| EXTERNAL_API_ERROR | Erreur lors de l'appel à une API externe |
| VALIDATION_ERROR | Données invalides fournies |
| INTERNAL_ERROR | Erreur serveur interne |
-
PC (Windows, macOS, Linux)
-
PlayStation (PS4, PS5)
-
Xbox (Xbox One, Xbox Series X/S)
-
Nintendo Switch
-
Mobile (iOS, Android)
Les contributions sont les bienvenues ! Voici comment participer :
-
Fork le projet
-
Créer une branche (
git checkout -b feature/AmazingFeature) -
Commit les changements (
git commit -m 'Add AmazingFeature') -
Push vers la branche (
git push origin feature/AmazingFeature) -
Ouvrir une Pull Request
Ce projet est sous licence MIT.
-
RAWG : https://rawg.io/apidocs (clé gratuite requise)
-
CheapShark : https://apidocs.cheapshark.com (gratuit, sans clé)
-
Steam Store : https://steamapi.xpaw.me (gratuit, sans clé)
-
RAWG API : 20,000 requêtes/mois (gratuit)
-
Cache : Réduit considérablement les appels externes
-
Rate limiting : 60 req/min pour protéger l'infrastructure
Pour toute question ou problème :
-
Ouvrir une issue sur GitHub
-
Consulter la documentation interactive :
/docs
-
Support de SteamGridDB pour plus d'images
-
Intégration IGDB pour notes supplémentaires
-
Système de favoris utilisateur
-
Webhooks pour notifications de prix
-
Export CSV/JSON des données
-
GraphQL endpoint
Note : Cette API est conçue pour un usage éducatif et personnel. Respectez les conditions d'utilisation des APIs externes.