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.2.0.tar.gz (11.0 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.2.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ownerrez_wrapper-0.2.0.tar.gz
  • Upload date:
  • Size: 11.0 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.2.0.tar.gz
Algorithm Hash digest
SHA256 cbb284809e82a35dca806de4af155c3d9bbe68480a048d0a1bff443e9a7f4905
MD5 3243e63ef84cc882a8b1aeda26f075bd
BLAKE2b-256 240937c35bd30df468171ce9e160d9abf04c3e8cb817b3f2f1847f81c76458b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ownerrez_wrapper-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 21e687995ee610f142605bb76e7f2ab7b9be1fdc35aa6d69414927f23338b138
MD5 1e4a67707af8f1dd558214cde0a71230
BLAKE2b-256 c010df767dfc86e8f9539ac10182dde52b8628f0d9eabe183363b245502bbe16

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