# -*- coding: utf-8 -*-
from setuptools import setup

modules = \
['whoop']
install_requires = \
['Authlib>=1.0.1,<2.0.0', 'requests>=2.28.1,<3.0.0']

setup_kwargs = {
    'name': 'whoop',
    'version': '0.1.0',
    'description': 'Tools for acquiring and analyzing WHOOP API data.',
    'long_description': '# WHOOP for Python <!-- omit in toc -->\n\nTools for acquiring and analyzing Whoop API data.\n\nWHOOP is a wearable strap for monitoring sleep, activity, and workouts. Learn more about WHOOP at https://www.whoop.com.\n\nWHOOP API documentation can be found at https://developer.whoop.com/api.\n\n## Contents <!-- omit in toc -->\n\n- [Installation](#installation)\n- [Getting Started](#getting-started)\n- [API Requests](#api-requests)\n  - [Get Profile](#get-profile)\n  - [Get Body Measurement](#get-body-measurement)\n  - [Get Cycle By ID](#get-cycle-by-id)\n  - [Get Cycle Collection](#get-cycle-collection)\n  - [Get Recovery For Cycle](#get-recovery-for-cycle)\n  - [Get Recovery Collection](#get-recovery-collection)\n  - [Get Sleep By ID](#get-sleep-by-id)\n  - [Get Sleep Collection](#get-sleep-collection)\n  - [Get Workout By ID](#get-workout-by-id)\n  - [Get Workout Collection](#get-workout-collection)\n- [Usage With DataFrame](#usage-with-dataframe)\n\n## Installation\n\nThe `whoop` module can be installed via pip:\n\n`pip install whoop`\n\n## Getting Started\n\nIn order to use the WHOOP client, you must have your WHOOP email and password.\n\nIt is best practice to store these values in a `.env` file:\n\n```bash\n# WHOOP credentials\nUSERNAME="<USERNAME>"\nPASSWORD="<PASSWORD>"\n```\n\nYou can use [`python-dotenv`](https://github.com/theskumar/python-dotenv) to load the enviroment variables for use in code:\n\n```python\nimport os\nfrom dotenv import load_dotenv\n\nload_dotenv()\n\nun = os.getenv("USERNAME") or ""\npw = os.getenv("PASSWORD") or ""\n```\n\nOnce the environment variables are loaded, a `WhoopClient` object can be created:\n\n```python\nfrom whoop import WhoopClient\n\n# Using a traditional constructor\nclient = WhoopClient(username, password)\n...\n\n# Using a context manager\nwith WhoopClient(username, password) as client:\n    ...\n```\n\nThe WHOOP client will authenticate the client upon construction by default. This involves fetching an access token from the API. If you don\'t want this request to happen automatically, pass `authenticate=False` into the object constructor. In order to make other requests, you will need to manually call the `authenticate()` method so that the other requests have the proper authorization headers:\n\n```python\nclient = WhoopClient(\n    client_id, client_secret, refresh_token, authenticate=False\n)\n\nclient.authenticate()\n...\n```\n\n## API Requests\n\nThere are ten different API requests that `WhoopClient` can make. Full WHOOP API documentation can be found on [WHOOP\'s website](https://developer.whoop.com/api).\n\n### Get Profile\n\nGet the user\'s basic profile.\n\n**Method**: `get_profile()`\n\n**Payload**: None\n\n**Example Response**:\n\n```python\n{\n    "user_id": 10129,\n    "email": "jsmith123@whoop.com",\n    "first_name": "John",\n    "last_name": "Smith"\n}\n```\n\n### Get Body Measurement\n\nGet the user\'s body measurements.\n\n**Method**: `get_body_measurement()`\n\n**Payload**: None\n\n**Example Response**:\n\n```python\n{\n    "height_meter": 1.8288,\n    "weight_kilogram": 90.7185,\n    "max_heart_rate": 200\n}\n```\n\n### Get Cycle By ID\n\nGet the cycle for the specified ID.\n\n**Method**: `get_cycle_by_id(cycle_id: str)`\n\n**Payload**:\n\n- `cycle_id`: ID of the cycle to retrieve. Passed into the request path.\n\n**Example Response**:\n\n```python\n{\n    "id": 93845,\n    "user_id": 10129,\n    "created_at": "2022-04-24T11:25:44.774Z",\n    "updated_at": "2022-04-24T14:25:44.774Z",\n    "start": "2022-04-24T02:25:44.774Z",\n    "end": "2022-04-24T10:25:44.774Z",\n    "timezone_offset": "-05:00",\n    "score_state": "SCORED",\n    "score": {\n        "strain": 5.2951527,\n        "kilojoule": 8288.297,\n        "average_heart_rate": 68,\n        "max_heart_rate": 141\n    }\n}\n```\n\n### Get Cycle Collection\n\nGet all physiological cycles for a user. Results are sorted by start time in descending order.\n\n**Method**: `get_cycle_collection(start_date: str = None, end_date: str = <today\'s date>)`\n\n**Payload**:\n\n- `startDate`: The earliest date for which to get data, pulled from the `start_date` parameter. Returns cycles that occurred after or during (inclusive) this time. Expected in ISO 8601 format (YYYY-MM-DD HH:MM:SS). Defaults to no start date.\n- `endDate`: The latest date for which to get data, pulled from the `end_date` parameter. Returns cycles that intersect this time or ended before (exclusive) this time. Expected in ISO 8601 format (YYYY-MM-DD HH:MM:SS). Defaults to today\'s date.\n\n**Example Response**:\n\n```python\n[\n    {\n        "id": 93845,\n        "user_id": 10129,\n        "created_at": "2022-04-24T11:25:44.774Z",\n        "updated_at": "2022-04-24T14:25:44.774Z",\n        "start": "2022-04-24T02:25:44.774Z",\n        "end": "2022-04-24T10:25:44.774Z",\n        "timezone_offset": "-05:00",\n        "score_state": "SCORED",\n        "score": {\n            "strain": 5.2951527,\n            "kilojoule": 8288.297,\n            "average_heart_rate": 68,\n            "max_heart_rate": 141\n        }\n    },\n    ...\n]\n```\n\n### Get Recovery For Cycle\n\nGet the recovery for a cycle\n\n**Method**: `get_recovery_for_cycle(cycle_id: str)`\n\n**Payload**:\n\n- `cycle_id`: ID of the cycle to retrieve. Passed into the request path.\n\n**Example Response**:\n\n```python\n {\n    "cycle_id": 93845,\n    "sleep_id": 10235,\n    "user_id": 10129,\n    "created_at": "2022-04-24T11:25:44.774Z",\n    "updated_at": "2022-04-24T14:25:44.774Z",\n    "score_state": "SCORED",\n    "score": {\n        "user_calibrating": False,\n        "recovery_score": 44,\n        "resting_heart_rate": 64,\n        "hrv_rmssd_milli": 31.813562,\n        "spo2_percentage": 95.6875,\n        "skin_temp_celsius": 33.7\n    }\n}\n```\n\n### Get Recovery Collection\n\nGet all recoveries for a user. Results are sorted by start time of the related sleep in descending order.\n\n**Method**: `get_recovery_collection(start_date: str = None, end_date: str = <today\'s date>)`\n\n**Payload**:\n\n- `startDate`: The earliest date for which to get data, pulled from the `start_date` parameter. Returns cycles that occurred after or during (inclusive) this time. Expected in ISO 8601 format (YYYY-MM-DD HH:MM:SS). Defaults to no start date.\n- `endDate`: The latest date for which to get data, pulled from the `end_date` parameter. Returns cycles that intersect this time or ended before (exclusive) this time. Expected in ISO 8601 format (YYYY-MM-DD HH:MM:SS). Defaults to today\'s date.\n\n**Example Response**:\n\n```python\n[\n    {\n        "cycle_id": 93845,\n        "sleep_id": 10235,\n        "user_id": 10129,\n        "created_at": "2022-04-24T11:25:44.774Z",\n        "updated_at": "2022-04-24T14:25:44.774Z",\n        "score_state": "SCORED",\n        "score": {\n            "user_calibrating": False,\n            "recovery_score": 44,\n            "resting_heart_rate": 64,\n            "hrv_rmssd_milli": 31.813562,\n            "spo2_percentage": 95.6875,\n            "skin_temp_celsius": 33.7\n        }\n    },\n    ...\n]\n```\n\n### Get Sleep By ID\n\nGet the sleep for the specified ID.\n\n**Method**: `get_sleep_by_id(sleep_id: str)`\n\n**Payload**:\n\n- `sleep`: ID of the sleep to retrieve. Passed into the request path.\n\n**Example Response**:\n\n```python\n{\n    "id": 93845,\n    "user_id": 10129,\n    "created_at": "2022-04-24T11:25:44.774Z",\n    "updated_at": "2022-04-24T14:25:44.774Z",\n    "start": "2022-04-24T02:25:44.774Z",\n    "end": "2022-04-24T10:25:44.774Z",\n    "timezone_offset": "-05:00",\n    "nap": False,\n    "score_state": "SCORED",\n    "score": {\n        "stage_summary": {},\n        "sleep_needed": {},\n        "respiratory_rate": 16.11328125,\n        "sleep_performance_percentage": 98,\n        "sleep_consistency_percentage": 90,\n        "sleep_efficiency_percentage": 91.69533848\n    }\n}\n```\n\n### Get Sleep Collection\n\nGet all sleeps for a user. Results are sorted by start time in descending order.\n\n**Method**: `get_sleep_collection(start_date: str = None, end_date: str = <today\'s date>)`\n\n**Payload**:\n\n- `startDate`: The earliest date for which to get data, pulled from the `start_date` parameter. Returns sleeps that occurred after or during (inclusive) this time. Expected in ISO 8601 format (YYYY-MM-DD HH:MM:SS). Defaults to no start date.\n- `endDate`: The latest date for which to get data, pulled from the `end_date` parameter. Returns sleeps that intersect this time or ended before (exclusive) this time. Expected in ISO 8601 format (YYYY-MM-DD HH:MM:SS). Defaults to today\'s date.\n\n**Example Response**:\n\n```python\n[\n    {\n        "id": 93845,\n        "user_id": 10129,\n        "created_at": "2022-04-24T11:25:44.774Z",\n        "updated_at": "2022-04-24T14:25:44.774Z",\n        "start": "2022-04-24T02:25:44.774Z",\n        "end": "2022-04-24T10:25:44.774Z",\n        "timezone_offset": "-05:00",\n        "nap": False,\n        "score_state": "SCORED",\n        "score": {\n            "stage_summary": {},\n            "sleep_needed": {},\n            "respiratory_rate": 16.11328125,\n            "sleep_performance_percentage": 98,\n            "sleep_consistency_percentage": 90,\n            "sleep_efficiency_percentage": 91.69533848\n        }\n    },\n    ...\n]\n```\n\n### Get Workout By ID\n\nGet the workout for the specified ID.\n\n**Method**: `get_workout_by_id(workout_id: str)`\n\n**Payload**:\n\n- `workout_id`: ID of the workout to retrieve. Passed into the request path.\n\n**Example Response**:\n\n```python\n{\n    "id": 1043,\n    "user_id": 9012,\n    "created_at": "2022-04-24T11:25:44.774Z",\n    "updated_at": "2022-04-24T14:25:44.774Z",\n    "start": "2022-04-24T02:25:44.774Z",\n    "end": "2022-04-24T10:25:44.774Z",\n    "timezone_offset": "-05:00",\n    "sport_id": 1,\n    "score_state": "SCORED",\n    "score": {\n        "strain": 8.2463,\n        "average_heart_rate": 123,\n        "max_heart_rate": 146,\n        "kilojoule": 1569.34033203125,\n        "percent_recorded": 100,\n        "distance_meter": 1772.77035916,\n        "altitude_gain_meter": 46.64384460449,\n        "altitude_change_meter": -0.781372010707855,\n        "zone_duration": {}\n    }\n}\n```\n\n### Get Workout Collection\n\nGet all workouts for a user. Results are sorted by start time in descending order.\n\n**Method**: `get_workout_collection(start_date: str = None, end_date: str = <today\'s date>)`\n\n**Payload**:\n\n- `startDate`: The earliest date for which to get data, pulled from the `start_date` parameter. Returns workouts that occurred after or during (inclusive) this time. Expected in ISO 8601 format (YYYY-MM-DD HH:MM:SS). Defaults to no start date.\n- `endDate`: The latest date for which to get data, pulled from the `end_date` parameter. Returns workouts that intersect this time or ended before (exclusive) this time. Expected in ISO 8601 format (YYYY-MM-DD HH:MM:SS). Defaults to today\'s date.\n\n**Example Response**:\n\n```python\n[\n    {\n        "id": 1043,\n        "user_id": 9012,\n        "created_at": "2022-04-24T11:25:44.774Z",\n        "updated_at": "2022-04-24T14:25:44.774Z",\n        "start": "2022-04-24T02:25:44.774Z",\n        "end": "2022-04-24T10:25:44.774Z",\n        "timezone_offset": "-05:00",\n        "sport_id": 1,\n        "score_state": "SCORED",\n        "score": {\n            "strain": 8.2463,\n            "average_heart_rate": 123,\n            "max_heart_rate": 146,\n            "kilojoule": 1569.34033203125,\n            "percent_recorded": 100,\n            "distance_meter": 1772.77035916,\n            "altitude_gain_meter": 46.64384460449,\n            "altitude_change_meter": -0.781372010707855,\n            "zone_duration": {}\n        }\n    },\n    ...\n]\n```\n\n## Usage With DataFrame\n\nUsing WHOOP API data with a Pandas DataFrame is very straightforward:\n\n```python\n>>> import pandas as pd\n\n>>> sleep = client.get_sleep_collection("2022-05-01", "2022-05-07")\n>>> pd.json_normalize(sleep)\n\n          id  user_id                created_at                updated_at  \\\n0  430878903   995945  2022-05-07T14:56:28.389Z  2022-05-07T15:12:22.933Z\n1  430378149   995945  2022-05-06T18:11:27.029Z  2022-05-06T18:11:29.172Z\n2  429704502   995945  2022-05-05T14:31:14.954Z  2022-05-05T14:43:15.744Z\n3  429055399   995945  2022-05-04T13:35:13.911Z  2022-05-04T13:35:15.758Z\n4  428375477   995945  2022-05-03T12:26:02.170Z  2022-05-03T12:26:04.151Z\n5  427873268   995945  2022-05-02T15:55:10.734Z  2022-05-02T15:55:13.140Z\n6  427300091   995945  2022-05-01T17:06:54.808Z  2022-05-01T17:06:57.067Z\n7  427069852   995945  2022-05-01T11:26:47.991Z  2022-05-01T11:26:49.684Z\n\n                      start                       end timezone_offset    nap  \\\n0  2022-05-07T04:46:52.867Z  2022-05-07T14:40:57.427Z          -04:00  False\n1  2022-05-06T05:09:00.681Z  2022-05-06T15:09:12.415Z          -04:00  False\n2  2022-05-05T04:59:16.774Z  2022-05-05T14:29:44.886Z          -04:00  False\n3  2022-05-04T05:04:02.916Z  2022-05-04T13:28:57.733Z          -04:00  False\n4  2022-05-03T05:29:46.133Z  2022-05-03T12:14:54.861Z          -04:00  False\n5  2022-05-02T05:12:48.073Z  2022-05-02T15:49:36.453Z          -04:00  False\n6  2022-05-01T11:53:13.942Z  2022-05-01T14:51:19.894Z          -04:00   True\n7  2022-05-01T06:14:52.087Z  2022-05-01T09:19:14.856Z          -04:00  False\n\n  score_state  score.stage_summary.total_in_bed_time_milli  \\\n0      SCORED                                     35643599\n1      SCORED                                     35460907\n2      SCORED                                     34240959\n3      SCORED                                     30293855\n4      SCORED                                     24307767\n5      SCORED                                     38003623\n6      SCORED                                     10396599\n7      SCORED                                     11004129\n\n   score.stage_summary.total_awake_time_milli  \\\n0                                     3744035\n1                                     2064515\n2                                     2937299\n3                                     2769352\n4                                     3384733\n5                                     2235345\n6                                      681103\n7                                     1608235\n\n   score.stage_summary.total_no_data_time_milli  \\\n0                                             0\n1                                             0\n2                                             0\n3                                             0\n4                                             0\n5                                             0\n6                                             0\n7                                             0\n\n   score.stage_summary.total_light_sleep_time_milli  \\\n0                                          15384266\n1                                          13169346\n2                                          12210534\n3                                          12689932\n4                                           6655383\n5                                          11195003\n6                                           5900698\n7                                           4971785\n\n   score.stage_summary.total_slow_wave_sleep_time_milli  \\\n0                                            7633425\n1                                            7874053\n2                                            7814364\n3                                            5554196\n4                                            5526290\n5                                           10101551\n6                                            1762533\n7                                            3008130\n\n   score.stage_summary.total_rem_sleep_time_milli  \\\n0                                         8881873\n1                                        12352993\n2                                        11278762\n3                                         9280375\n4                                         8741361\n5                                        14471724\n6                                         2052265\n7                                         1415979\n\n   score.stage_summary.sleep_cycle_count  \\\n0                                      8\n1                                      9\n2                                      5\n3                                      4\n4                                      4\n5                                      9\n6                                      3\n7                                      1\n\n   score.stage_summary.disturbance_count  score.sleep_needed.baseline_milli  \\\n0                                     17                           27975800\n1                                     12                           27976121\n2                                     21                           27976442\n3                                     15                           27976764\n4                                     12                           27977085\n5                                      8                           27977406\n6                                      1                           27977728\n7                                      4                           27977728\n\n   score.sleep_needed.need_from_sleep_debt_milli  \\\n0                                              0\n1                                         359692\n2                                        3237274\n3                                        3636979\n4                                              0\n5                                        9792092\n6                                        9792204\n7                                        2098329\n\n   score.sleep_needed.need_from_recent_strain_milli  \\\n0                                            367539\n1                                            304726\n2                                            655901\n3                                           1812597\n4                                            270597\n5                                            426795\n6                                                 0\n7                                           1463907\n\n   score.sleep_needed.need_from_recent_nap_milli  score.respiratory_rate  \\\n0                                              0               13.398438\n1                                              0               13.066406\n2                                              0               12.568359\n3                                              0               13.164062\n4                                              0               13.535156\n5                                       -9715496               13.535156\n6                                              0               14.121094\n7                                              0               14.941406\n\n   score.sleep_performance_percentage  score.sleep_consistency_percentage  \\\n0                               100.0                                83.0\n1                               100.0                                81.0\n2                                98.0                                75.0\n3                                82.0                                68.0\n4                                74.0                                65.0\n5                               100.0                                62.0\n6                                26.0                                51.0\n7                                30.0                                78.0\n\n   score.sleep_efficiency_percentage\n0                          89.857010\n1                          94.178050\n2                          91.421684\n3                          91.993940\n4                          89.586520\n5                          94.118080\n6                          93.448790\n7                          87.927660\n\n[8 rows x 25 columns]\n```\n',
    'author': 'Josh Hejka',
    'author_email': 'josh@joshhejka.com',
    'maintainer': 'None',
    'maintainer_email': 'None',
    'url': 'https://github.com/hedgertronic/whoop',
    'py_modules': modules,
    'install_requires': install_requires,
    'python_requires': '>=3.10,<4.0',
}


setup(**setup_kwargs)
