Metadata-Version: 2.1
Name: withings2intervals
Version: 0.1.0
Summary: Sync Withings data to Intervals.icu
Author: Stefano Mosconi
Author-email: stefano.mosconi@gmail.com
Requires-Python: >=3.12,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: requests (>=2.32.3,<3.0.0)
Description-Content-Type: text/markdown


# Withings2Intervals

A Python script to sync wellness data from Withings to [Intervals.icu](https://intervals.icu).

This script is a fork of [this Gist](https://gist.github.com/fruitloop/7e79eeab9fd4ba7d2be5cdf8175d2267) and has been enhanced with features such as:
- Configurable start dates for syncing.
- Prevention of duplicate syncing using a log file.
- Added debugging support via a `-v` flag.
- Refactored for better maintainability and extensibility.

## Features
- Fetches data from Withings using their API.
- Uploads wellness data (weight, body fat, blood pressure, etc.) to Intervals.icu.
- Tracks synced days to avoid duplicate uploads.
- Supports a `--force-resync` option to re-upload data.
- Debugging support with `-v`.

## Installation

1. **Clone the Repository**:
   ```bash
   git clone https://github.com/your-username/withings_syncer.git
   cd withings_syncer
   ```

2. **Install Dependencies with Poetry**:
   Make sure you have [Poetry](https://python-poetry.org/docs/#installation) installed.
   ```bash
   poetry install
   ```

3. **Set Up Configuration Files**:
   Create a `config.ini` file with your API credentials:
   ```ini
   [Withings]
   client_id = YOUR_CLIENT_ID
   client_secret = YOUR_CLIENT_SECRET
   redirect_uri = http://localhost:80

   [Intervals]
   icu_api_key = YOUR_ICU_API_KEY
   icu_athlete_id = YOUR_ATHLETE_ID

   [Fields]
   weight_field = weight
   bodyfat_field = bodyFat
   diastolic_field = diastolic
   systolic_field = systolic
   muscle_field = MuscleMass
   temp_field = BodyTemperature

   [General]
   withings_config = ./withings.json
   ```

## Usage

Run the script with the following options:

- **Sync Today's Data**:
  ```bash
  python withings2intervals.py
  ```

- **Sync Data from a Specific Date**:
  ```bash
  python withings2intervals.py --start 2024-12-01
  ```

- **Force Resync**:
  ```bash
  python withings2intervals.py --force-resync
  ```

- **Verbose Debugging**:
  ```bash
  python withings2intervals.py -v
  ```

## Acknowledgments
- [Fruitloop's Original Gist](https://gist.github.com/fruitloop/7e79eeab9fd4ba7d2be5cdf8175d2267)

