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

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

Metadata

Release files for aibnbclean 2.6.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.6.0.0
File Size Uploaded
aibnbclean-2.6.0.0.tar.gz 111.8 kB Details

Built distribution (wheel)

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

Total release size: 130.2 kB

Release files / aibnbclean-2.6.0.0.tar.gz

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

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