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.2

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.2
File Size Uploaded Provenance Actions
fatsecret-6.0.2.tar.gz 60.6 kB Without provenance Details for fatsecret-6.0.2.tar.gz

Built distribution (wheel)

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

Total release size: 140.2 kB

Release files / fatsecret-6.0.2.tar.gz

Download URL fatsecret-6.0.2.tar.gz
Size 60.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3f3fc01e7101fd70f85d398c4f1f7822c380643f7f62dfacb08611432cc2098e
BLAKE2b-256 checksum
How to use checksums
1cd130ee59192840a0cb1d7ad28d3774bf30d3c1a41c64ac24600bab95bff8b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","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.2-py3-none-any.whl

Download URL fatsecret-6.0.2-py3-none-any.whl
Size 79.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6874fe414c7b3781eb3978a86654cad5b2afed4c9dabe2defe1cc330a4c9ac13
BLAKE2b-256 checksum
How to use checksums
c59942d73794c733303e986ba62fb67af4abcb5cd6bbe1f0f9aec3e5c4cb8863
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","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.2

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.2 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