Giter Club home page Giter Club logo

flow's Introduction

vrslev/flow

Simple app for reposting posts from VK to Telegram. Can be easily deployed as AWS lambda function.

Configuration

Since main deployment method is as lambda function, configuration is done with environment variables.

VK_TOKEN

VK app service token. To get it you need to create a VK app and copy app service token from there.

VK_OWNER_ID

Source ID of VK group.

TG_TOKEN

Telegram bot token. Create a bot

TG_CHAT_ID

Target Telegram chat or channel id.

DB_PATH

Path to SQLite database file. Default is /tmp/database.db

SENTRY_DSN (optional)

DSN for sentry error reports

Usage

Lambda

  1. Set up S3 bucket,
  2. Set these environment variables along with variables in Configuration section: S3_BUCKET, S3_KEY, S3_ENDPOINT, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY,
  3. Set entrypoint to flow.main.lambda_handler,
  4. Clone this repo and upload zip archive generated by bash scripts/prepare_artifact.sh,
  5. Configure timer trigger for the function.

Local setup

  1. Clone and install the app. Note that you need to have poetry installed.
git clone --depth 1 https://github.com/vrslev/flow.git
cd flow
poetry install
  1. Configure .env file with the variables,
  2. Run:
poetry run python3 flow/main.py

With Python as library

  1. Install with pip:
pip install git+https://github.com/vrslev/flow.git
  1. Use flow wherever you want. For example:
from flow.main import main
from flow.models import Settings

settings = Settings()
main(settings)

Each call publishes only one post, doesn't matter if there's more available. This is done so you can easily customize publishing schedule (and use it in lambda ๐Ÿ˜).

flow's People

Contributors

dependabot[bot] avatar vrslev avatar

Stargazers

 avatar

Watchers

 avatar

flow's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.