Skip to main content

fatsecret

status Documentation Status

This library provides a lightweight python wrapper for the Fatsecret API with the goal of making it easier to visualize the data retrieved from the API. To that end, this library will usually return lists of identical elements for ease of plotting, discarding extra header fields that the Fatsecret API otherwise includes. All API calls return either a single or list of JSON dictionaries.

What's new in v3

Methods on the namespaced surface (fs.foods.*, fs.recipes.*, fs.diary.*, fs.profile.*, fs.weight.*, fs.exercises.*) now return typed Pydantic v2 models — Food, Recipe, Profile, FoodEntry, ExerciseEntry, Day, etc. — instead of plain dicts. Use dotted attribute access (food.food_id, not food["food_id"]) or call .to_dict() on any model for the v2 dict shape. pydantic>=2.7 is now a base dependency. See the v3 migration guide for side-by-side examples and the four resources (Food Classification, Saved Meals, Native APIs, Feedback) that intentionally still return dicts.

Installation

pip install fatsecret

Requires Python 3.11+.

Unofficial member-website recipe CRUD, recipe copying, and RDI operations are available through FatsecretWebClient. To run the optional authenticated HTTP facade, install fatsecret[facade]. These operations automate unstable member HTML forms and are not part of the supported FatSecret Platform API.

Config

Register for a developer account at Fatsecret. You will need your Consumer Key and Consumer Secret key for your application.

Usage

Fatsecret supports both delegated and public calls. Only through delegated calls can you access Fatsecret user profile data.

If you only need public data:

from fatsecret import Fatsecret

fs = Fatsecret(consumer_key, consumer_secret)
foods = fs.foods_search_v5("Tacos")          # current upstream version
# or, to pin to a specific historical shape:
foods = fs.foods_search_v1("Tacos")

Every method carries an explicit _vN version suffix matching FatSecret's multi-version API. Unsuffixed names (foods_search, food_get, …) still exist as DeprecationWarning-emitting aliases and will be removed in v2.0. Surface the warnings during development:

python -W default::DeprecationWarning:fatsecret your_script.py

For OAuth2 client-credentials (required for Premier / Native endpoints):

fs = Fatsecret(client_id, client_secret, auth="oauth2", scopes=["basic", "premier"])

Both Fatsecret and FatsecretWebClient accept timeout and retries configuration. The default retry policy applies only to safe GET requests; mutations are never retried automatically.

Refer to the documentation for further examples and detail.

Documentation

Docs are published to Read the Docs. Every released tag and the current master branch are auto-built — use the version dropdown in the bottom-left flyout to switch between them.

Contributing

All contributions are welcome! I'm not actively maintaining this library, so there's a good chance that any API changes have not been implemented in this wrapper.

Metadata

Release files for fatsecret 6.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fatsecret 6.0.4
File Size Uploaded Provenance Actions
fatsecret-6.0.4.tar.gz 60.5 kB Without provenance Details for fatsecret-6.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fatsecret 6.0.4
File Interpreter ABI Platform Actions
fatsecret-6.0.4-py3-none-any.whl Python 3 none any Details for fatsecret-6.0.4-py3-none-any.whl

Total release size: 140.1 kB

Release files / fatsecret-6.0.4.tar.gz

Download URL fatsecret-6.0.4.tar.gz
Size 60.5 kB
Tags Source
SHA-256 checksum
How to use checksums
82c1efc7ae84d62d0fa2ca99715f4ab758c8f73f21d64ea1507f873d9b2a4ec9
BLAKE2b-256 checksum
How to use checksums
451d0c4e96f8e897699a745280105278218e20402d57c1fad7af2a1990ebf559
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fatsecret-6.0.4-py3-none-any.whl

Download URL fatsecret-6.0.4-py3-none-any.whl
Size 79.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
055ec9652843188355b28b000deb514929d9245a4366309ebf0a7b7c6a154368
BLAKE2b-256 checksum
How to use checksums
93411ba8eb252dc1f178da009bdea2f7f95468f7f2de6ff45fe62214859aff1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for fatsecret 6.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

6.0.4 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page