Python / Django
Sync vacation rental data with Python using the Repull SDK.
1
Prerequisites
Python 3.8+ installed on your machine.
You also need a Repull API key. Get one from your dashboard.
2
Install
pip install repull-sdk
3
Set up environment variables
Add your credentials to a .env file in your project root:
REPULL_API_KEY=sk_test_YOUR_KEY REPULL_WORKSPACE_ID=YOUR_WORKSPACE_ID
Start with sk_test_ keys for sandbox data. Switch to sk_live_ when you are ready for production.
4
Make your first API call
Set up the client with your API key, then call any endpoint. The example below lists properties and fetches reservations.
# views.py (Django)
from django.http import JsonResponse
from repull import Repull
dom = Repull(
api_key="sk_live_YOUR_KEY",
workspace_id="YOUR_WORKSPACE_ID",
)
def reservations(request):
"""How do I get reservations from all channels with Python?"""
result = dom.reservations.list(
status="CONFIRMED",
source=request.GET.get("source"), # AIRBNB, BOOKING_COM, VRBO
)
return JsonResponse(result)
def availability(request, property_id):
"""How do I check availability with Python?"""
result = dom.availability.get(
property_id=property_id,
start_date=request.GET.get("start"),
end_date=request.GET.get("end"),
)
return JsonResponse(result)
def update_pricing(request, property_id):
"""How do I update pricing with Python?"""
import json
data = json.loads(request.body)
result = dom.availability.update(
property_id=property_id,
updates=data["updates"],
)
return JsonResponse(result)
# Standalone script
if __name__ == "__main__":
properties = dom.properties.list()
for p in properties["data"]:
print(f"{p['id']} — {p['name']} ({p['status']})")5
Next steps
You are all set. Explore the rest of the platform:
AI