Skip to main content

aibnbclean

the following is some basic code that helps automate cleaning scheduling and communication for short-term rental properties such as Airbnb listings

  • it pulls booking data from airbnb calendars or google calendars
  • it uses google spreadsheets to track cleaning schedules and records
  • it uses playwright for web scraping and google gemini api to parse user messages for cleaning info
  • it sends text message reminders about upcoming cleaning dates via twilio
  • it sends cleaner payment tasks to todoist

Developer setup local machine windows

initial setup

# prerequisite installs
winget install --id python
winget install --id astral-sh.uv
winget install --id Google.Chrome

# clone this repo
git clone <repo url>

# cd to the code repo folder
cd <code repo folder>

# create a virtual environment and install dependencies from pyproject.toml
uv sync

.env file

create an .env file at the base of the code repo folder with the following content:

AIBNBCLEAN_CONFIG_DIR="C:/path/to/config/dir"
AIBNBCLEAN_HEADLESS="1"
AIBNBCLEAN_GEMINI_MODEL="gemini-flash-latest"

listings.json

create listings.json in the config directory specified in the .env file

[
    {
        "name": "My cool Airbnb",
        "type": "airbnb",
        "laundry": "yes",
        "url": "https://www.airbnb.com/calendar/ical/xxxxxxxx.ics?s=yyyyyyy",
        "spreadsheet_id": "google_spreadsheet_id",
        "spreadsheet_sheet_name": "Sheet1",
        "spreadsheet_sheet_id": 0,
        "spreadsheet_bitly_url": "bitly_url_to_spreadsheet",
        "default_cleaning_fee": 140,
        "qty_to_process": 10,
        "guests": {
            "min": 1,
            "max": 4
        },
        "beds": {
            "min": 1,
            "max": 2
        },
        "pnp_beds": {
            "min": 0,
            "max": 1
        },
        "days_addrm_notice": 14,
        "todoist_project_name": "airbnb"
    }
]

secrets.json

create listings.json in the config directory specified in the .env file

{
    "gemini_api_key": "api_key",
    "todoist_api_key": "api_key",
    "twilio": {
        "client": "clientid:clientsecret",
        "from_number": "+18005551212",
        "to_number": "+18005562323"
    },
    "google_sa": {
        "type": "service_account",
        "project_id": "google-cloud-project-id",
        "private_key_id": "private_key_id",
        "private_key": "private_key_contents",
        "client_email": "client@project.iam.gserviceaccount.com",
        "client_id": "clientid",
        "auth_uri": "https://accounts.google.com/o/oauth2/auth",
        "token_uri": "https://oauth2.googleapis.com/token",
        "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
        "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/client%40project.iam.gserviceaccount.com",
        "universe_domain": "googleapis.com"
    }
}

Production setup on raspberry pi with gui interface

sudo adduser airbnb

sudo usermod -aG adm,dialout,cdrom,sudo,audio,video,render,plugdev,games,users,input,netdev,spi,i2c,gpio,lpadmin airbnb

config

define config directory, listings.json, secrets.json, .env file similar to developer setup above

initial install

# install uv package manager
curl -LsSf https://astral.sh/uv/install.sh | sh

# cd to config directory
cd ~/aibnbclean

# create .env and json files similar to above and place in config directory

# install
uv tool uninstall aibnbclean
uv tool install aibnbclean --refresh

# install playwright browser binaries
uv tool run --from playwright playwright install chromium

# execute the login function once to create browser_profile with access to airbnb
aibnbclean_login

# once logged in you should be able to do a test run
aibnbclean_process

run daily using cron

The following example runs at 1:30pm daily. Because cron runs in a minimal shell environment, you must make your environment variables (like AIBNBCLEAN_CONFIG_DIR) available to the process.

Open your crontab (crontab -e) and declare the variables at the top of the file:

AIBNBCLEAN_CONFIG_DIR="/home/airbnb/aibnbclean"
AIBNBCLEAN_HEADLESS="1"
AIBNBCLEAN_GEMINI_MODEL="gemini-flash-latest"

30 13 * * * date > /tmp/aibnbclean.log
30 13 * * * $HOME/.local/bin/aibnbclean_process >> /tmp/aibnbclean.log 2>&1

Metadata

Release files for aibnbclean 2.9.0.0

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

Source distribution (sdist)

Source distribution for aibnbclean 2.9.0.0
File Size Uploaded
aibnbclean-2.9.0.0.tar.gz 112.1 kB Details

Built distribution (wheel)

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

Total release size: 130.8 kB

Release files / aibnbclean-2.9.0.0.tar.gz

Download URL aibnbclean-2.9.0.0.tar.gz
Size 112.1 kB
Tags Source
SHA-256 checksum
How to use checksums
da9c748ee8e14748ddf21e67df94233afae5116abe58fc36a775a27e84685236
BLAKE2b-256 checksum
How to use checksums
597538fc6faa66bd71452b7351f4e1b60cb72b278574094dcf70486d19a1008a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","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 / aibnbclean-2.9.0.0-py3-none-any.whl

Download URL aibnbclean-2.9.0.0-py3-none-any.whl
Size 18.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c45a256668f1ea40595ab5185f534f078b9036673f6a7ff207f6bf6931c492a4
BLAKE2b-256 checksum
How to use checksums
f4a16e958849d1faa69227d7590821698a6053d0c8b851ed56f940d69c5d9011
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","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

2.9.0.0 This release

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