{"id":13593015,"url":"https://github.com/vangorra/python_withings_api","last_synced_at":"2025-04-09T02:32:05.200Z","repository":{"id":35149260,"uuid":"213526937","full_name":"vangorra/python_withings_api","owner":"vangorra","description":"Library for the Withings Health API","archived":false,"fork":false,"pushed_at":"2022-04-22T17:19:35.000Z","size":534,"stargazers_count":103,"open_issues_count":9,"forks_count":36,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-09T00:49:04.359Z","etag":null,"topics":["api","python3","withings"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vangorra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-08T02:02:54.000Z","updated_at":"2025-01-29T19:23:26.000Z","dependencies_parsed_at":"2022-07-25T19:17:37.216Z","dependency_job_id":null,"html_url":"https://github.com/vangorra/python_withings_api","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vangorra%2Fpython_withings_api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vangorra%2Fpython_withings_api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vangorra%2Fpython_withings_api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vangorra%2Fpython_withings_api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vangorra","download_url":"https://codeload.github.com/vangorra/python_withings_api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247965627,"owners_count":21025408,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","python3","withings"],"created_at":"2024-08-01T16:01:15.685Z","updated_at":"2025-04-09T02:32:03.514Z","avatar_url":"https://github.com/vangorra.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Python withings-api [![Build status](https://github.com/vangorra/python_withings_api/workflows/Build/badge.svg?branch=master)](https://github.com/vangorra/python_withings_api/actions?workflow=Build) [![Coverage Status](https://coveralls.io/repos/github/vangorra/python_withings_api/badge.svg?branch=master)](https://coveralls.io/github/vangorra/python_withings_api?branch=master) [![PyPI](https://img.shields.io/pypi/v/withings-api)](https://pypi.org/project/withings-api/)\nPython library for the Withings Health API\n\n\nWithings Health API\n\u003chttps://developer.withings.com/oauth2/\u003e\n\nUses OAuth 2.0 to authenticate. You need to obtain a client id\nand consumer secret from Withings by creating an application\nhere: \u003chttp://developer.withings.com/oauth2/\u003e\n\n## Installation\n\n    pip install withings-api\n\n## Usage\nFor a complete example, checkout the integration test in `scripts/integration_test.py`. It has a working example on how to use the API.\n```python\nfrom withings_api import WithingsAuth, WithingsApi, AuthScope\nfrom withings_api.common import get_measure_value, MeasureType\n\nauth = WithingsAuth(\n    client_id='your client id',\n    consumer_secret='your consumer secret',\n    callback_uri='your callback uri',\n    mode='demo',  # Used for testing. Remove this when getting real user data.\n    scope=(\n        AuthScope.USER_ACTIVITY,\n        AuthScope.USER_METRICS,\n        AuthScope.USER_INFO,\n        AuthScope.USER_SLEEP_EVENTS,\n    )\n)\n\nauthorize_url = auth.get_authorize_url()\n# Have the user goto authorize_url and authorize the app. They will be redirected back to your redirect_uri.\n\ncredentials = auth.get_credentials('code from the url args of redirect_uri')\n\n# Now you are ready to make calls for data.\napi = WithingsApi(credentials)\n\nmeas_result = api.measure_get_meas()\nweight_or_none = get_measure_value(meas_result, with_measure_type=MeasureType.WEIGHT)\n```\n\n## Building\nBuilding, testing and lintings of the project is all done with one script. You only need a few dependencies.\n\nDependencies:\n- python3 in your path.\n- The python3 `venv` module.\n\nThe build script will setup the venv, dependencies, test and lint and bundle the project.\n```bash\n./scripts/build.sh\n```\n\n## Integration Testing\nThere exists a simple integration test that runs against Withings' demo data. It's best to run this after you have\nsuccessful builds. \n\nNote: after changing the source, you need to run build for the integration test to pickup the changes.\n\n```bash\n./scripts/build.sh\nsource ./venv/bin/activate\n./scripts/integration_test.py --client-id \u003cyour client id\u003e --consumer-secret \u003cyour consumer secret\u003e --callback-uri \u003cyour clalback uri\u003e\n```\nThe integration test will cache the credentials in a `\u003cproject root\u003e/.credentials` file between runs. If you get an error saying\nthe access token expired, then remove that credentials file and try again.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvangorra%2Fpython_withings_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvangorra%2Fpython_withings_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvangorra%2Fpython_withings_api/lists"}