Skip to main content

A Python wrapper for the OwnerRez API

Project description

OwnerRez API Wrapper

A Python wrapper for the OwnerRez API. This package provides a simple and intuitive interface to interact with the OwnerRez API v2.

Requirements

  • Python 3.10 or higher

Installation

pip install ownerrez-wrapper

Python Usage

from ownerrez_wrapper import API
from datetime import datetime

# Initialize the API client
api = API(username="your_username", token="your_token")

# Get all properties
properties = api.getproperties()
for prop in properties:
    print(f"Property: {prop.name} (ID: {prop.id})")

# Get bookings for a property
bookings = api.getbookings(
    property_id=123,
    since_utc=datetime(2024, 1, 1)
)
for booking in bookings:
    print(f"Booking: {booking.arrival} to {booking.departure}")

# Get a specific booking
booking = api.getbooking(booking_id=456)
print(f"Guest ID: {booking.guest_id}")

# Get guest details
guest = api.getguest(guest_id=789)
print(f"Guest: {guest.first_name} {guest.last_name}")

# Check if a property is currently booked
is_booked = api.isunitbooked(property_id=123)
print(f"Property is booked: {is_booked}")

API Documentation

API Class Methods

  • getproperties() -> List[Property]

    • Returns a list of all properties
  • getproperty(property_id: int) -> Property

    • Get details for a specific property
    • Parameters:
      • property_id: The property ID
  • getbookings(property_id: int, since_utc: datetime) -> List[Booking]

    • Get bookings for a specific property since a given date
    • Parameters:
      • property_id: The property ID
      • since_utc: DateTime object for the start date
  • getbooking(booking_id: int) -> Booking

    • Get details for a specific booking
    • Parameters:
      • booking_id: The booking ID
  • getguest(guest_id: int) -> Guest

    • Get details for a specific guest
    • Parameters:
      • guest_id: The guest ID
  • isunitbooked(property_id: int) -> bool

    • Check if a property is currently booked
    • Parameters:
      • property_id: The property ID

Data Models

The API returns strongly-typed objects that provide a rich interface to the OwnerRez data. For detailed documentation of all data models, including all available fields and usage examples, see Data Models Documentation.

Main models:

  • Property: Contains property details (id, name, bedrooms, etc.)
  • Booking: Contains booking information (arrival, departure, guest, etc.)
  • Guest: Contains guest information (name, contact details, etc.)

Supporting models:

  • Address: Physical address information
  • EmailAddress: Email contact information
  • Phone: Phone contact information
  • Charge: Booking charge information
  • DoorCode: Property access codes

CLI Tool (for testing)

A command-line interface is included for testing and debugging. You can provide credentials via environment variables or a .env file:

# Using .env file
echo "OWNERREZ_USERNAME=your_username" > .env
echo "OWNERREZ_TOKEN=your_token" >> .env

# List properties
ownerrez properties

# Get property details
ownerrez property 123

# Check bookings
ownerrez bookings 123 --since 2024-01-01

# Get booking details
ownerrez booking 456

Development

To set up the development environment:

git clone https://github.com/gmoorevt/ownerrez-wrapper.git
cd ownerrez-wrapper
pip install -e ".[dev]"

To run tests:

pytest

License

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

Author

Contributing

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

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

ownerrez_wrapper-0.1.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

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

ownerrez_wrapper-0.1.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ownerrez_wrapper-0.1.0.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.14

File hashes

Hashes for ownerrez_wrapper-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9feccc15045511a05422d8e924125120bcd9e0930cad444752e69b43bda0197c
MD5 f0021f90ad4fb3161cc5eee0145811ca
BLAKE2b-256 b80200b5d48c90273d6a1983548eaef1758fcef8c23efa4b499afcf5f7d70a6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ownerrez_wrapper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9818e36578382fe4268e006c545459c373e0adac7c434108a1d44b6e1f7b9f2b
MD5 60a908fd747d63b768dd243690653614
BLAKE2b-256 2b1bacf1103044a123b6aaf5c451b1ebecd93424e4e6a8556e6fc98debac1eb1

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