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.5.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.5.0.0
File Size Uploaded
aibnbclean-2.5.0.0.tar.gz 111.8 kB Details

Built distribution (wheel)

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

Total release size: 130.2 kB

Release files / aibnbclean-2.5.0.0.tar.gz

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

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