Skip to main content

yawgbot

PyPI version Code style: black

Yet Another WG helper bot. WG stands for Wohngemeinschaft, a German word that refers to a living arrangement in which several tenants share an apartment. It is aimed to automate the extremely complex and time-consuming task of finding a room or an apartment to rent. Initially it was only working for wg-gesucht.de, now it's a plugin-based system ready to be extended for every platform to find accommodation.

From a technical standpoint yawgbot is a simple tool that runs different plugins. A plugin either scrapes websites using requests and beautifulsoup4 or uses APIs (both public and undocumented) both to search for listings and to contact landlords. It uses a SQLite database to save contacted ads and to perform fewer requests to platforms. It also comes with a simple web UI to track your progress and gather your findings across different platforms.
The database is stored:

  • on GNU/Linux at ~/.local/share/yawgbot/yawgbot.sqlite
  • on Windows at %USERPROFILE%\AppData\Local\rcastellotti\yawgbot\yawgbot.sqlite
  • on macOS at ~/Library/Application Support/yawgbot/yawgbot.sqlite

running manually

To run the bot manually:

  • install the package with pip3 install yawgbot (a virtual environment is suggested)
  • configure .config.myl, stored
    • on GNU/Linux at ~/.config/yawgbot/config.yml
    • on Windows at %USERPROFILE%\AppData\Local\rcastellotti\yawgbot\config.yml
    • on macOS at ~/Library/Preferences/yawgbot/config.yml
  • create a new file named bot.py with the following content and run it:
from yawgbot import Bot
import logging

logging.basicConfig(level=logging.INFO)
bot = Bot(platforms=["wg-gesucht"])
bot.run()

running periodically with celery

Running in background at time intervals is achieved using Celery to schedule tasks. It is configured to use SQLite as both backend and broker, to know more read the docs. The file run_yawgbot.py, for example, runs the bot each 5 minutes, to use it:

  • run celery -A run_yawgbot.celery worker --loglevel=INFO to run the worker
  • run celery -A run_yawgbot.celery beat to schedule the bot

web UI

To start the web UI simply run yawgbot-web

plugins

creating a plugin

Extending yawgbot is a pretty straightforward process. A plugin is a simple module extending the PluginBase class, an example is wg-gesucht.py, supported plugins can be used just by instantiating Bot with the platforms argument. Custom plugins can be registered using the Bot.register_plugin() method.
To start creating a template you can use this boilerplate code:

from yawgbot.pluginBase import PluginBase


class YawgbotPlugin(PluginBase):
    def __init__(self):
        pass

    def get_ads(self, url):
        pass

    def parse_ad(self, ad):
        pass

    def contact_ad(self, slug):
        pass

    def run(self):
        pass

If you develop a plugin, consider creating a PR, I will be more than happy to work with you to make it an official plugin and ship it with yawgbot.

Each plugin should load configuration values using the static Bot.config() method.
To better understand plugins you can read the code in src/yawgbot/plugins.

wg-gesucht

config

wg-gesucht:
  username: ""
  password: ""
  message_template: ""
  base_url: ""

When configuring for use go on https://wg-gesucht.de and copy the url you are using to look for accommodation, then replace the last number with {} in order to be able to search across multiple pages, for example, if looking for apartments in Munich: base url is https://www.wg-gesucht.de/1-zimmer-wohnungen-in-Munchen.90.1.1.1.html , replace the last 1 as follows: https://www.wg-gesucht.de/1-zimmer-wohnungen-in-Munchen.90.1.1.{}.html

Release files for yawgbot 0.0.7

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

Source distribution (sdist)

Source distribution for yawgbot 0.0.7
File Size Uploaded
yawgbot-0.0.7.tar.gz 14.5 kB Details

Built distribution (wheel)

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

Total release size: 25.7 kB

Release files / yawgbot-0.0.7.tar.gz

Download URL yawgbot-0.0.7.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
32c8da9fc7b82ad5d3080c0e4e2b1a58fae40d780d6e859c228b980f373e9594
BLAKE2b-256 checksum
How to use checksums
50bbec0d5443b9223377db26e9975083aeae67fafc23bc652b6632df3ca6ea14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.7

Release files / yawgbot-0.0.7-py3-none-any.whl

Download URL yawgbot-0.0.7-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa5ae9d062753905eb42b07c6a07e7837a38ba9670d4cae6ba2d687d5d4f434b
BLAKE2b-256 checksum
How to use checksums
8fc90c0dfd4006514d92746695b656d736282899510ae1cd89d34a5d317f8f29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.7

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

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