CLI for Yazio calorie tracking
Project description
yazio-cli
CLI pour le suivi nutritionnel Yazio, basé sur l'API non officielle reverse-engineered.
Installation
Binaire autonome (recommandé)
Linux / macOS (x86_64 et arm64) :
curl -fsSL https://raw.githubusercontent.com/cmoron/yazio-cli/main/install.sh | sh
Variables optionnelles : VERSION=v0.1.0 pour une version précise, INSTALL_DIR=$HOME/.local/bin pour un autre dossier.
Via PyPI
uv tool install yazio-cli
# ou
pipx install yazio-cli
Depuis les sources
cd ~/src/yazio-cli
uv sync
Authentification
Email / mot de passe (si tu en as un)
uv run yazio login
Apple / Google Sign-In (pas de mot de passe Yazio)
Si tu t'es inscrit via "Sign in with Apple" ou Google, tu n'as pas de mot de passe Yazio. Il faut extraire le token depuis le site web :
- Ouvre https://www.yazio.com/fr/app/account dans Firefox (ou Chrome)
- Connecte-toi avec ton compte Apple/Google
- Ouvre les DevTools : F12 → onglet Stockage (Firefox) ou Application (Chrome)
- Dans Cookies →
https://www.yazio.com, copie la valeur du cookieyz_session- C'est une longue chaîne qui commence par
Fe26.2**...
- C'est une longue chaîne qui commence par
- Lance la commande :
uv run yazio web-login --session-cookie 'Fe26.2**...'
Le CLI extrait les tokens API depuis la page web et les sauvegarde dans ~/.config/yazio/token.json. Le refresh est automatique tant que le refresh token est valide.
Si le token expire et que le refresh échoue, il suffit de refaire l'étape ci-dessus.
Commandes
yazio summary [DATE] Résumé journalier (calories, macros, eau, pas)
yazio meals [DATE] Détail des aliments consommés
yazio water [DATE] Consommation d'eau
yazio goals [DATE] Objectifs nutrition
yazio exercises [DATE] Exercices du jour
yazio weight [--days N] Historique de poids (30 jours par défaut)
yazio search <query> Chercher un aliment dans la base Yazio
yazio add <ID> --amount N --meal breakfast|lunch|dinner|snack
Ajouter un aliment au journal
yazio remove <ID> Supprimer une entrée
DATE est au format YYYY-MM-DD, par défaut aujourd'hui.
API Python
Le module yazio_cli.api peut être importé directement :
from yazio_cli import api
summary = api.daily_summary("2026-04-09")
items = api.consumed_items("2026-04-09")
results = api.search_products("poulet")
Formats de retour (API)
Toutes les fonctions retournent des dict JSON (sauf search_products → list[dict] et remove_consumed_item → None).
daily_summary(date)
{
"activity_energy": 492,
"consume_activity_energy": true,
"steps": 8132,
"water_intake": 2000,
"goals": {
"energy.energy": 3064.7,
"water": 2000,
"activity.step": 10000,
"nutrient.protein": 156.9,
"nutrient.fat": 83.0,
"nutrient.carb": 282.4,
"bodyvalue.weight": 65
},
"units": {
"unit_mass": "kg",
"unit_energy": "kcal",
"unit_serving": "g",
"unit_length": "cm"
},
"meals": {
"breakfast": {
"energy_goal": 919.4,
"nutrients": {
"energy.energy": 727.1,
"nutrient.carb": 68.2,
"nutrient.fat": 33.2,
"nutrient.protein": 33.6
}
},
"lunch": { "energy_goal": 1225.9, "nutrients": { "..." : "..." } },
"dinner": { "energy_goal": 766.2, "nutrients": { "..." : "..." } },
"snack": { "energy_goal": 153.2, "nutrients": { "..." : "..." } }
},
"user": {
"start_weight": 64.1,
"current_weight": 64.5,
"goal": "build_muscle",
"sex": "male"
},
"active_fasting_countdown_template_key": null
}
consumed_items(date)
Retourne 3 listes : products, recipe_portions, simple_products.
products[] — aliments de la base Yazio (pas de nutriments inline, il faut appeler get_product) :
{
"id": "45595f92-...",
"date": "2026-04-09 13:18:40",
"daytime": "breakfast",
"type": "product",
"product_id": "9d9b131a-...",
"amount": 20,
"serving": "tablespoon",
"serving_quantity": 1
}
simple_products[] — aliments personnalisés/IA (nutriments inline, valeurs absolues) :
{
"id": "c32dbfc9-...",
"date": "2026-04-09 13:19:11",
"daytime": "lunch",
"type": "simple_product",
"name": "Bol de poulet grillé avec riz mélangé, avocat, maïs, poivron et laitue",
"nutrients": {
"energy.energy": 519,
"nutrient.protein": 44,
"nutrient.fat": 19,
"nutrient.carb": 39
},
"is_ai_generated": true
}
get_product(product_id)
Détail d'un produit. Les nutriments sont par gramme (multiplier par amount pour le total).
{
"name": "Filets de poulet",
"is_verified": true,
"category": "poultry",
"producer": null,
"base_unit": "g",
"nutrients": {
"energy.energy": 1.02,
"nutrient.protein": 0.2355,
"nutrient.fat": 0.007,
"nutrient.carb": 0.0,
"nutrient.sugar": 0.0,
"nutrient.dietaryfiber": 0.0,
"nutrient.saturated": 0.0021,
"nutrient.sodium": 0.00066,
"...": "vitamines, minéraux..."
},
"servings": [
{ "serving": "piece.medium", "amount": 125.0 },
{ "serving": "g", "amount": 100.0 }
],
"language": "fr"
}
search_products(query) → list[dict]
Retourne une liste de produits (max 50). Nutriments par gramme.
[
{
"score": 110,
"name": "Filets de poulet",
"product_id": "9d7ca984-...",
"serving": "piece.medium",
"serving_quantity": 1,
"amount": 125,
"base_unit": "g",
"producer": null,
"is_verified": true,
"nutrients": {
"energy.energy": 1.02,
"nutrient.carb": 0.0,
"nutrient.fat": 0.007,
"nutrient.protein": 0.2355
},
"language": "fr"
}
]
water_intake(date)
{
"water_intake": 2000.0,
"gateway": null,
"source": null
}
goals(date)
{
"energy.energy": 2572.7,
"nutrient.protein": 156.9,
"nutrient.fat": 83.0,
"nutrient.carb": 282.4,
"water": 2000.0,
"activity.step": 10000.0,
"bodyvalue.weight": 65.0
}
exercises(date)
{
"training": [
{
"id": "74f6b7de-...",
"date": "2026-04-09 18:45:57",
"name": "cycling",
"energy": 321.0,
"distance": 21047,
"duration": 45,
"gateway": "apple_health",
"steps": 0
}
],
"custom_training": [
{
"id": "41bf4508-...",
"date": "2026-04-09 11:57:02",
"name": "Mes exercices personnalisés",
"energy": 171.0,
"duration": 66,
"gateway": "apple_health",
"steps": 0
}
],
"activity": {
"energy": 0.0,
"distance": 4756,
"duration": 0,
"gateway": "apple_health",
"steps": 8132
}
}
weight(start, end) → list[dict]
[
{ "date": "2026-03-08 09:04:02", "value": 63.4 },
{ "date": "2026-04-09 07:26:11", "value": 64.5 }
]
add_consumed_item(product_id, amount, date, meal)
Ajoute un aliment. meal : breakfast, lunch, dinner, snack.
remove_consumed_item(item_id)
Supprime une entrée (par id du consumed item, pas le product_id). Retourne None.
Développement
uv run ruff check src/ tests/ # lint
uv run ruff format src/ tests/ # format
uv run mypy src/ # types
uv run pytest -v # tests
Notes
- API non officielle — peut cesser de fonctionner si Yazio modifie son backend
- Basé sur le travail de juriadams/yazio
- Token stocké en clair dans
~/.config/yazio/token.json - Les nutriments des produits sont par gramme (pas pour 100g)
- Les nutriments des
simple_productssont des valeurs absolues (pas par gramme)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yazio_cli-0.1.1.tar.gz.
File metadata
- Download URL: yazio_cli-0.1.1.tar.gz
- Upload date:
- Size: 29.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7417fa5a99675050d3efda8b0527f49c44640520c63b2ef4c02ae62901023bb
|
|
| MD5 |
e01726d2b6bd7b0ab96baf7366341155
|
|
| BLAKE2b-256 |
a138b7169e27804909d4147dad95c1d62d7849d208cbb832eb36521976a7aa2f
|
Provenance
The following attestation bundles were made for yazio_cli-0.1.1.tar.gz:
Publisher:
release.yml on cmoron/yazio-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yazio_cli-0.1.1.tar.gz -
Subject digest:
d7417fa5a99675050d3efda8b0527f49c44640520c63b2ef4c02ae62901023bb - Sigstore transparency entry: 1270536211
- Sigstore integration time:
-
Permalink:
cmoron/yazio-cli@e144f4d7254b0ad1b3810298b90311701accac83 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/cmoron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e144f4d7254b0ad1b3810298b90311701accac83 -
Trigger Event:
push
-
Statement type:
File details
Details for the file yazio_cli-0.1.1-py3-none-any.whl.
File metadata
- Download URL: yazio_cli-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bb982266116e44046e7296d8efdb7ee928c932f6f3cfed73c7e294827030547
|
|
| MD5 |
54b662f6a541a6e65d0dc08d28ef6fdc
|
|
| BLAKE2b-256 |
d3e1f3415fc6271575b70cbb4d6109574b713100c64b8101ffc76e562e243616
|
Provenance
The following attestation bundles were made for yazio_cli-0.1.1-py3-none-any.whl:
Publisher:
release.yml on cmoron/yazio-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yazio_cli-0.1.1-py3-none-any.whl -
Subject digest:
8bb982266116e44046e7296d8efdb7ee928c932f6f3cfed73c7e294827030547 - Sigstore transparency entry: 1270536232
- Sigstore integration time:
-
Permalink:
cmoron/yazio-cli@e144f4d7254b0ad1b3810298b90311701accac83 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/cmoron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e144f4d7254b0ad1b3810298b90311701accac83 -
Trigger Event:
push
-
Statement type: