harperreed / emfitapi-python

MIT License
0 stars 0 forks source link

EmfitAPI Python Wrapper

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 .

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:

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.