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.8.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.8.0.0
File Size Uploaded
aibnbclean-2.8.0.0.tar.gz 111.7 kB Details

Built distribution (wheel)

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

Total release size: 130.0 kB

Release files / aibnbclean-2.8.0.0.tar.gz

Download URL aibnbclean-2.8.0.0.tar.gz
Size 111.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9e9f82a6b8b150b7e7400cdcde75672381b50618d9b891d38a72dc80d52633c9
BLAKE2b-256 checksum
How to use checksums
48011cd7e10621d799d8f3143c8531cd61fce012d831ed37ca45252c3ed1ed89
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.8.0.0-py3-none-any.whl

Download URL aibnbclean-2.8.0.0-py3-none-any.whl
Size 18.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9855d3f3ad851e52967170788eafda5c748fed2355c5ed21a5fe1ed6ba7963bb
BLAKE2b-256 checksum
How to use checksums
5814c0488dfa91fe317bf6cf5bc31fc7f6621cb21b66b0379290cff29d35425f
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.8.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