Skip to main content

Add your description here

Project description

EmfitAPI Python Wrapper

CI codecov Python 3.11+ License: MIT

Overview

EmfitAPI is a Python wrapper for the Emfit QS API. It provides methods to authenticate, fetch user and device data, and retrieve various metrics such as presence, trends, and timeline data from Emfit devices.

Installation

You can install the EmfitAPI wrapper using pip:

pip install git+https://github.com/harperreed/emfitapi-python.git

Or, if you've downloaded the source:

git clone https://github.com/harperreed/emfitapi-python.git
cd emfitapi-python
pip install .

Development Installation

For development, we recommend using uv:

git clone https://github.com/harperreed/emfitapi-python.git
cd emfitapi-python
uv sync --all-extras

Usage

Initializing the API

To start using the EmfitAPI, you need to instantiate the class:

from emfit.api import EmfitAPI

api = EmfitAPI(token="your_token_here")

If you don't have a token, you can obtain one by logging in:

api = EmfitAPI()
response = api.login("your_username", "your_password")

Making Requests

After authentication, you can use various methods to interact with the API:

  • get_user(): Fetches user information.
  • get_device_status(device_id): Retrieves the status of a specific device.
  • get_device_info(device_id): Fetches information of a specific device.
  • get_latest_presence(device_id): Gets the latest presence information for a device.
  • get_presence(device_id, presence_id): Retrieves presence information for a specific device and presence ID.
  • get_trends(device_id, start_date, end_date): Fetches trend data for a device within a specified date range.
  • get_timeline(device_id, start_date, end_date): Retrieves timeline data for a device within a specified date range.
  • get_notification_settings(device_id): Gets the notification settings for a specific device.

Example

# Retrieve and print user information
user_info = api.get_user()
print(user_info)

# Fetch and print device status
device_status = api.get_device_status("device_id_here")
print(device_status)

Logging

EmfitAPI uses Python's logging module to log information, warnings, and errors. Configure the logging level as needed.

Exception Handling

The wrapper raises exceptions when API requests fail. Ensure to handle these exceptions in your application.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

emfitapi_python-0.1.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

emfitapi_python-0.1.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file emfitapi_python-0.1.0.tar.gz.

File metadata

  • Download URL: emfitapi_python-0.1.0.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.3

File hashes

Hashes for emfitapi_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7100022a159da45717e5ac79a48fb83aba459594863532c4fd873a9d13675544
MD5 2a76de972ce805f6e8100ecea495aa87
BLAKE2b-256 1bb238971be68db1305db1c4f942b5cb88a31ccc0f2e9d5e5f462aeec7e6b978

See more details on using hashes here.

File details

Details for the file emfitapi_python-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for emfitapi_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4725002f317ccbf4f786441cc9761cacbe362ade3c3626ea97ec6606b29a1bd6
MD5 10b23f15b6441ab9fff1cc73eefa7e87
BLAKE2b-256 53cae201a72a2250caf1161e09da64062cd842a83aa48639850d6edc49517f88

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page