Commit Graph

45 Commits

Author SHA1 Message Date
Simone Robutti d89659735d
added event selection function (#25) 2021-07-07 11:41:13 +02:00
Simone Robutti 40919a994f
publication window (#24)
* added get events stub

* added event parsing

* removed datetime

* added config and tests

* fixed response format in test

* more tests

* added error handling for request

* improved dummy data

* added get_unpublished_events

* added test

* removed last_accessed

* mobilizon_url moved to fixture

* added config comments

* moved mobilizon group to config

* added method

* removed non-working test settings

* added publishing window logic and tests

* added inner/outer window check and mocking

* improved fixture

* fixed outer window

* fixed tests
2021-07-07 11:19:37 +02:00
tinoilcotechino 6cea51bcab
Publications (#28)
* mobilizon_bots: query: Add create_publisher.

* Move PublicationStatus to models.publication.

* Move NotificationStatus to models.notification.

* storage: query: Add events_with_status.

* storage: query: Add get_unpublished_events.

* storage: query: Add create_unpublished events.

This function takes care of looking into the database
to store only the events whose  is not
already present.

* event: event: Support multiple publications.

This patch changes the public interface of `MobilizonEvent` to
support multiple publications. This mainly entails two changes:

  - When instancing a `MobilizonEvent`  from an `Event` model
    the `publication_status` will be computed by looking at
    the statuses of all the related publications.
  - Now the `publication_time` is a `dict[str, Arrow]`. This
    enables tracking multiple social platforms publication time.

* Update main.

* Minor fixes

* Better definition of MobilizonEvent.publication_status.

Co-authored-by: Giacomo Leidi <goodoldpaul@autistici.org>
2021-07-05 23:07:12 +02:00
Simone Robutti c8dc529682
documentation (#26)
* documentation skeleton

* more documentation
2021-07-05 22:49:57 +02:00
Simone Robutti 891d523751
added CLI (#27) 2021-07-05 21:58:29 +02:00
SlyK182 de3e503cd6
Notification system (#13)
* Fixed typo

* Added proper exceptions for publishers

* Updated publishers logics: using messengers to allow publications without events

* Added new exception 'InvalidSettings'

* Updated notifiers and publishers: retrieve credentials and destination from config, use only message/event in constructors, lesser refactoring

* Updated publishers' tests

* Updated notifiers and publishers config for Telegram service, updated settings.toml file

* Updated 'post()' method and removed useless config checks for Telegram bot

* Added jinja2 template management for message formatting methods

* Manage message validation in publishers' run() method

* Better config management for notifiers and publishers

* Lesser update to logging and error-raising management (#23)
2021-07-05 21:44:11 +02:00
Giacomo Leidi dd664089d8 main: Use get_published_events query. 2021-05-31 01:19:24 +02:00
tinoilcotechino c129edd1e5
Add models (#18) 2021-05-31 01:11:50 +02:00
tinoilcotechino 48c72a6118
Merge pull request #17 from Tech-Workers-Coalition-Italia/gracefully_crash
main: Gracefully tear down DB on exception.
2021-05-30 23:07:07 +02:00
Giacomo Leidi e51e8f160f :main: Gracefully tear down DB on exception. 2021-05-30 23:03:34 +02:00
Simone Robutti fcd5116d1c
download events (#19)
* added get events stub

* added event parsing

* removed datetime

* added config and tests

* fixed response format in test

* more tests

* added error handling for request

* improved dummy data

* added get_unpublished_events

* added test

* removed last_accessed

* mobilizon_url moved to fixture

* added config comments

* moved mobilizon group to config
2021-05-30 21:47:36 +02:00
Simone Robutti 044c66eb5b
Merge pull request #15 from Tech-Workers-Coalition-Italia/main_loop
Main loop
2021-05-14 23:10:04 +02:00
Simone Robutti 95dacc139a
Merge pull request #12 from Tech-Workers-Coalition-Italia/conf_skeleton
Conf skeleton
2021-05-14 23:09:34 +02:00
Simone Robutti 0e236a4be3 added main loop stub 2021-05-13 13:32:56 +02:00
Simone Robutti ed2d016715 added notifier config 2021-05-09 17:22:14 +02:00
Simone Robutti 765b78dfb9 added conf for strategies and publisher 2021-05-09 17:17:48 +02:00
Simone Robutti d3f647c2fe moved event_selector 2021-05-09 16:15:07 +02:00
tinoilcotechino 47f8c0aa17
Merge pull request #4 from Tech-Workers-Coalition-Italia/conf
Basic configuration.
2021-05-09 15:59:41 +02:00
Giacomo Leidi f5ba924e92 Versioning will be handled elsewhere. 2021-05-09 15:57:04 +02:00
Simone Robutti 23be6d8812
Merge pull request #6 from Tech-Workers-Coalition-Italia/event_selector
Event selector
2021-05-09 15:45:08 +02:00
Simone Robutti 136ba12205 removed unused import 2021-05-09 15:41:11 +02:00
Simone Robutti 214e2a0c3b added more tests 2021-05-05 14:37:19 +02:00
Simone Robutti 4f194ab01c added tests for strategy 2021-05-05 14:29:13 +02:00
Simone Robutti 3fe3c8efc6 added event selector (w/o tests) 2021-05-04 22:58:00 +02:00
Simone Robutti e938ba709b added begins_before 2021-05-04 12:07:59 +02:00
Simone Robutti 821f2a6435 added jinja 2021-05-04 11:48:54 +02:00
Giacomo Leidi 218e228e6a pyproject.toml: Update pytest to 5.3. 2021-05-03 19:51:19 +02:00
Giacomo Leidi 6a51dc86ee mobilizon_bots: Configure logger with dynaconf.
* mobilizon_bots/cli.py: New file.
* mobilizon_bots/config.py: Minor tweaks.
* mobilizon_bots/settings.toml: Downcase variables, drop jinja2
templating in favor of format, add logging configuration.
2021-05-03 19:48:04 +02:00
Giacomo Leidi 0d02f2dd52 Init configuration 2021-05-03 18:31:37 +02:00
Simone Robutti 44c3f57365 added event class and format 2021-05-03 17:26:34 +02:00
Simone Robutti 6273e56311 restructured folders 2021-05-03 15:11:22 +02:00
Simone Robutti 559a5d4e64
Merge pull request #3 from Tech-Workers-Coalition-Italia/storage
Init storage.
2021-05-02 18:49:52 +02:00
Giacomo Leidi ab69908a66 Init storage. 2021-05-02 18:44:08 +02:00
Simone Robutti d78ab809a7 updated to python 3.9 2021-05-02 18:33:13 +02:00
Simone Robutti 5c9f5d37cd
Merge pull request #2 from Tech-Workers-Coalition-Italia/publishers-dev
Publishers dev
2021-05-02 18:10:41 +02:00
Simone Robutti 06f2f3343b added .idea to .gitignore 2021-05-02 16:43:17 +02:00
Simone Robutti df837b17b6 changed visiblity log methods in publisher 2021-05-02 11:27:07 +02:00
Simone Robutti a45c2c19ec added test predicates 2021-05-02 11:23:31 +02:00
Simone Robutti fabc1e7eff added predicates 2021-05-02 10:47:38 +02:00
Simone Robutti fb00516d6c reworked validation 2021-05-02 10:37:46 +02:00
Simone Robutti a6a14d2689 changed logger to be more pythonic 2021-05-02 10:24:46 +02:00
ComradeSlyK b60971206f Add abstract functioning for publishers, mock-up for Telegram publisher 2021-05-02 10:07:52 +02:00
Simone Robutti 07bba0f752 added README for pre-commit 2021-04-25 11:13:59 +02:00
Simone Robutti f3bd228510 added .gitignore and pre-commit 2021-04-25 11:10:47 +02:00
Simone Robutti d61ad2537d first commit 2021-04-18 16:10:45 +02:00