Skip to main content

fressnapftracker

Asynchronous Python client for the Fressnapf Tracker GPS API

GitHub Actions PyPi License

Installation

uv add fressnapftracker

Usage

Email Authentication Flow

Use your Fressnapf account credentials to request a sign-in link by email:

import asyncio

from fressnapftracker import AuthClient


async def main() -> None:
    """Show the email authentication flow."""
    async with AuthClient() as auth:
        # Step 1: Request the email sign-in link
        response = await auth.request_magic_link("<EMAIL>", "<PASSWORD>")
        user_id = response.user.id
        access_token = response.user_token.access_token
        customer_id = response.customer_id

        # Step 2: Open the link in the email, then check its status
        input("Open the sign-in link, then press Enter: ")
        if not await auth.check_magic_link_was_clicked(access_token):
            raise RuntimeError("The sign-in link has not been opened")

        # Step 3: Complete authentication and get the tracker devices
        await auth.complete_magic_link(user_id, access_token, customer_id)
        devices = await auth.get_devices(user_id, access_token)
        for device in devices:
            print(f"Device: {device.serialnumber} - Token: {device.token}")


if __name__ == "__main__":
    asyncio.run(main())

check_magic_link_was_clicked() performs one status request. Applications that poll should choose an appropriate interval and timeout.

Legacy SMS Authentication Flow

Phone-number authentication remains available for existing accounts:

async with AuthClient() as auth:
    sms_response = await auth.request_sms_code("+49123456789")
    sms_code = input("Enter SMS code: ")
    response = await auth.verify_phone_number(sms_response.id, sms_code)
    devices = await auth.get_devices(sms_response.id, response.user_token.access_token)

Getting Tracker Data

import asyncio

from fressnapftracker import ApiClient


async def main() -> None:
    """Show example of getting tracker data."""
    async with ApiClient(
        serial_number="<YOUR_SERIAL_NUMBER>",
        device_token="<YOUR_DEVICE_TOKEN>",
    ) as api:
        tracker = await api.get_tracker()
        print(f"Pet name: {tracker.name}")
        print(f"Battery: {tracker.battery}%")
        if tracker.position:
            print(f"Location: {tracker.position.lat}, {tracker.position.lng}")


if __name__ == "__main__":
    asyncio.run(main())

Controlling the Tracker

import asyncio

from fressnapftracker import ApiClient


async def main() -> None:
    """Show example of controlling the tracker."""
    async with ApiClient(
        serial_number="<YOUR_SERIAL_NUMBER>",
        device_token="<YOUR_DEVICE_TOKEN>",
    ) as api:
        # Set LED brightness (0-100)
        await api.set_led_brightness(75)

        # Enable/disable deep sleep mode
        await api.set_deep_sleep(True)


if __name__ == "__main__":
    asyncio.run(main())

API Reference

AuthClient

Client for handling authentication with the Fressnapf Tracker API.

Constructor Parameters

  • request_timeout (int, optional): Request timeout in seconds (default: 10)
  • client (httpx.AsyncClient, optional): Custom httpx client to use
  • user_agent (str, optional): Custom user agent string

Methods

  • request_magic_link(email: str, password: str, locale: str = "en") -> MagicLinkResponse: Request an email sign-in link
  • check_magic_link_was_clicked(user_access_token: str) -> bool: Check once whether the email sign-in link has been opened
  • complete_magic_link(user_id: int, user_access_token: str, customer_id: str) -> TrackerUser: Complete email authentication
  • request_sms_code(phone_number: str, locale: str = "en") -> SmsCodeResponse: Request an SMS verification code
  • verify_phone_number(user_id: int, sms_code: str) -> PhoneVerificationResponse: Verify a phone number with its SMS code
  • get_devices(user_id: int, user_access_token: str) -> list[Device]: Get the authenticated user's devices

ApiClient

Client for interacting with the Fressnapf Tracker device API.

Constructor Parameters

  • serial_number (str): The serial number of your tracker device (required)
  • device_token (str): The device token for API authentication (required)
  • request_timeout (int, optional): Request timeout in seconds (default: 10)
  • client (httpx.AsyncClient, optional): Custom httpx client to use
  • user_agent (str, optional): Custom user agent string

Methods

  • get_tracker() -> Tracker: Get current tracker data
  • set_led_brightness(brightness: int): Set LED brightness (0-100)
  • set_deep_sleep(enabled: bool): Enable/disable deep sleep mode

Models

Tracker

  • name: Pet/device name
  • battery: Battery percentage
  • charging: Whether the device is charging
  • position: Position data (lat, lng, accuracy)
  • tracker_settings: Device settings and features
  • led_brightness: LED brightness settings
  • deep_sleep: Deep sleep settings

MagicLinkResponse

  • user: Tracker user ID and Fressnapf account email address
  • user_token: Access token and current magic-link confirmation status
  • customer_id: Fressnapf customer ID needed to complete authentication

TrackerUser

  • id: Tracker user ID
  • email: Fressnapf account email address
  • additional_parameters: Fressnapf-specific account settings

Device

  • serialnumber: Device serial number
  • token: Device token for API calls

Exceptions

  • FressnapfTrackerError: Base exception
  • FressnapfTrackerConnectionError: Connection/timeout errors
  • FressnapfTrackerAuthenticationError: Authentication errors
  • FressnapfTrackerInvalidTokenError: Invalid auth token
  • FressnapfTrackerInvalidDeviceTokenError: Invalid device token
  • FressnapfTrackerInvalidSerialNumberError: Invalid serial number

Release files for fressnapftracker 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fressnapftracker 0.3.1
File Size Uploaded
fressnapftracker-0.3.1.tar.gz 48.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fressnapftracker 0.3.1
File Interpreter ABI Platform
fressnapftracker-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 63.7 kB

Release files / fressnapftracker-0.3.1.tar.gz

Download URL fressnapftracker-0.3.1.tar.gz
Size 48.9 kB
Tags Source
SHA-256 checksum
How to use checksums
865c6991cf5b4d3cb5331315dd31ee47179b8fe5667c93ae7a85c05489f5e6cc
BLAKE2b-256 checksum
How to use checksums
46d7d282c62252d420d363ee7cf8c4ffa5375b9f837fd36c54fce21c5c65a911
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fressnapftracker-0.3.1-py3-none-any.whl

Download URL fressnapftracker-0.3.1-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6fdd0c5d80bcc006ed4491df191fbbbbf6510ae5ef2a90e3e81a34edc0145602
BLAKE2b-256 checksum
How to use checksums
01b5dc2d6b14f62e0087f42c92f46e7380864a7c3e2589aabd5d179bb0f39c70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page