Welcome to pyfatsecret’s documentation!

Introduction

pyfatsecret is a Python wrapper designed to facilitate interactions with the Fatsecret API using OAuth 2.0. This documentation aims to provide all the necessary information to get started with pyfatsecret, including installation, configuration, and basic usage examples.

Installation

Before installing pyfatsecret, ensure Python and the requests library are installed:

pip install requests

To install pyfatsecret (note: not yet available on PyPI):

pip install pyfatsecret

Please refer to the development documentation for setting up the environment to contribute to pyfatsecret:

pip install -r requirements-dev.txt

Getting Started

To use pyfatsecret, you’ll need to obtain credentials from Fatsecret by registering for a developer account. Remember, Fatsecret requires IP whitelisting for API access.

Quick Start Example

Here’s how to quickly start searching for food items:

from pyfatsecret import Fatsecret

# Initialize the client with your credentials
fatsecret = Fatsecret(client_id='your_client_id', client_secret='your_client_secret')

# Search for a food item
result = fatsecret.foods.foods_search("Apple")
print(result)

Auto-generation of Modules

autogen.py is used to regenerate all modules based on the latest API information:

python autogen.py

Contributing

Contributions to pyfatsecret are welcomed. Please focus changes on fatsecret_base.py and autogen.py as other modules are auto-generated.

Indices and tables