USDA Food Data Central (FDC) Python Client
A comprehensive Python library for interacting with the USDA Food Data Central API, designed for easy integration with Django applications and local database caching.
Key Features
Complete API Coverage: Access all endpoints of the USDA FoodData Central API
Object-Oriented Interface: Work with food data using intuitive Python objects
Django Integration: Seamlessly integrate with Django applications
Local Database Caching: Cache API responses for improved performance
Command-Line Interface: Quick access to food data from the terminal
Comprehensive Data Models: Structured models for all FDC data types
Unit Conversion: Convert between different food measurement units
Batch Operations: Efficiently process multiple food items
Nutrient Analysis: Analyze nutrient content and compare to dietary reference intakes
Recipe Analysis: Calculate nutritional information for recipes
Installation
pip install usda-fdc
Or install from source:
git clone https://github.com/mcgarrah/usda_fdc_python
cd usda_fdc_python
pip install -e .
Contents
User Guide
- Installation
- Quickstart
- Migrating to 0.2.0
- At a glance
- 1. A missing food now raises its own exception
- 2.
status_codeexists now — and the documented retry works - 3. DRI percentages can now be
None - 4.
DriType.ULreturns data — in grams - 5. Calories no longer come back as kilojoules
- 6. The API key travels as a header
- 7. Abridged foods keep their nutrients
- Configuration
- Django Integration
- Command-Line Interface
- Nutrient Analysis
- Examples
- Advanced Usage
- Error Handling
API Reference
Development