Skip to main content

A Twitter bot that tweets aerial imagery pictures of municipalities

Project description

Munibot

Tests

Munibot is friendly Twitter bot that posts aerial or satellite imagery of administrative regions (tipically municipalities).

munis_cat_scaled

It is written in a modular way so it's easy to customize to different data sources, via the implementation of profiles.

It currently powers the following Twitter accounts:

  • @munibot_es: All municipalities in Spain, shown in random order, with base aerial ortophotograhy from PNOA IGN.

  • @munibot_cat: All municipalities in Catalonia, shown in random order, with base aerial ortophotograhy from ICGC.

Here's how a sample tweet looks like:

example_tweet

Usage

Installation

Munibot is available on PyPI and can be installed with pip. It is strongly recommended to install it in a virtual environment:

python3 -m venv munibot
source munibot/bin/activate

pip install munibot

Or alternatively, using pipx:

pipx install munibot

Munibot uses Rasterio and Fiona, which require GDAL. The wheels installed by pip on Linux (and macOS, although I have not tested it) include binaries for GDAL that cover munibot's need so it doesn't need to be installed separately. On other operating systems you might need to install GDAL.

Configuration

Munibot uses an ini file for configuration. You can download the sample ini file included in this repository running:

curl https://raw.githubusercontent.com/amercader/munibot/main/munibot.sample.ini -o munibot.ini

or:

wget https://raw.githubusercontent.com/amercader/munibot/main/munibot.sample.ini -O munibot.ini

If you want to try the es and cat profiles included in the main library, you'll also need the backend SQLite database:

wget https://github.com/amercader/munibot/raw/main/data/munis_esp.sqlite

Adapt the db_path entries in the configuration to the path where you saved the database.

Running it

Once munibot is installed, you should be able to run

munibot --help

Munibot assumes that the configuration ini file is located in the same folder the command is run on (and named "munibot.ini"). If that's not the case, you can pass the location of the configuration file with the --config or -c arguments:

munibot -c /path/to/munibot.ini

If at least a profile is available and all the necessary authorization tokens are available in the ini file (TODO) just run the following to tweet a new image:

munibot tweet es

If you only want to create the image without tweeting it use the create command:

munibot create es

Deploying it

TODO

Twitter Authorization

TODO

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

munibot-0.0.2.tar.gz (11.3 kB view details)

Uploaded Source

File details

Details for the file munibot-0.0.2.tar.gz.

File metadata

  • Download URL: munibot-0.0.2.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5

File hashes

Hashes for munibot-0.0.2.tar.gz
Algorithm Hash digest
SHA256 f9cf9d25348a19e53f966a41e6041a9981547d3d06dcf67451293c9fcf89cc72
MD5 7e4eaecf58efdb64bd40950662dc7e6e
BLAKE2b-256 8ac0aed0f9a5a9967d02a9d6fc07a76c502ac7e135c0dccd677d6f8ed72d2415

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page