Skip to main content

A framework to automate reacting to ActivityStreams events.

Project description

Mechanical Bull

Mechanical Bull is an ActivityPub Client application build based on bovine. It's main goal is to provide a platform for automating activities undertaking in the FediVerse. Furthermore, it serves as a demonstration how ActivityPub Clients can be build with bovine.

Installation

One can simply install mechanical_bull with pip via

pip install mechanical-bull

Once can then add a new user by running

python -m mechanical_bull.add_user [--accept] name hostname

This will then prompt you to add a new did:key to your ActivityPub Actor. This did:key will be used to authenticate mechanical_bull against your server. Once you have added the key, press enter, and mechanical_bull is running. This method of authentication is called Moo-Auth-1 and described here.

The configuration is saved in config.toml. bovine also supports authentication through private keys and HTTP signatures. For the details on how to configure this, please consult bovine. You can add further automations there.

Then you should be able to run mechanical bull via

python -m mechanical_bull.run

Configuration

First by adding log_file = "mechanical_bull.log" to your config.toml you can make mechanical_bull write log entries to a file. Second, the config file has the following format

logfile = "mechanical_bull.log"

[cow]
private_key = "z3u2Yxcowsarethebestcowsarethebestcowsarethebest"
host = "cows.rocks"

[cow.handlers]
"mechanical_bull.actions.reject_follow_request" = true
# "mechanical_bull.actions.accept_follow_request" = true
"mechanical_bull.actions.log_to_file" = { filename = "cow.txt" }

The listed handlers are provided by mechanical_bull. They allow to accept / reject follow requests automatically, and the final one logs all traffic on the event source to "cow.txt".

Writing automations

The examples of mechanical_bull.actions.accept_follow_request and mechanical_bull.actions.log_to_file should show how to write a new automation. The basic idea is that each file contains a function handle with signature

async def handle(client: BovineClient, data: dict, **kwargs):
    return

here the kwargs are the dict given by the definiton in the handler block, i.e.

[user.handlers]
"my.package" = { arg1 = "value1", arg2 = "value2 }

Contibuting

Please report bugs, etc. to the issue tracker. Contributings in the form of pull requests are welcome. You can also contact me on the FediVerse at @helge@mymath.rocks.

Finally, I plan a multi-user "server" version of this project called mechanical_herd. The functionality should be similar, but updating the configuration should not require a restart. One might also think hooking into the redis from bovine_pubsub for this. mechanical_herd will probably be part of the bovine user management interface.

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

mechanical_bull-0.0.6.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

mechanical_bull-0.0.6-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file mechanical_bull-0.0.6.tar.gz.

File metadata

  • Download URL: mechanical_bull-0.0.6.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.3 Linux/5.10.0-21-amd64

File hashes

Hashes for mechanical_bull-0.0.6.tar.gz
Algorithm Hash digest
SHA256 2404df4cd4475da315b83e110b7ac67466eeb3d06c5073824ded4d31f635c384
MD5 06c1b8ffb6abcb906264e70a1b1ec72e
BLAKE2b-256 427e6c90814dad05c10ddda9a16b2602d20d8a1c7b269cb8d5b75f82c4b3e085

See more details on using hashes here.

File details

Details for the file mechanical_bull-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: mechanical_bull-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.3 Linux/5.10.0-21-amd64

File hashes

Hashes for mechanical_bull-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 cf6f28d49cc53ff2a042fc62d89ce952b06bff9b762254ef91633152354ac25e
MD5 d5063aa0c2364007deca0ba81fa24fce
BLAKE2b-256 d56b4c218c56378adbc40da30697260d9b2ca79718b5e14e75bf4d742c370fc5

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