Git Product home page Git Product logo

ratsitlarm's Introduction

Ratsitlarm

Are you waiting for your personnummer having moved to Sweden? Use this python module to make the waiting a bit more pleasant. Incorporating AWS Lambda and SNS, the module sends a notification when there's a hit.

INSTALL

If you wish to run the module on AWS Lambda, make a periodic event rule that fires every 30 mins or hour on EventBridge. Create an SNS topic for hit notification.

The AWS role/user will need following permissions:

  • logs:CreateLogGroup
  • logs:CreateLogStream
  • logs:PutLogEvents
  • sns:Publish
  • events:DisableRule

Copy the config files and edit them to suit your needs.

cp doc/config.jsonc doc/query.jsonc src

Note that profile and region are inferred by the SDK if running on Lambda or EC2. In such case, all the config should specify are topic and rule. Delete the disable-events mapping altogether if used locally.

Run it locally

Install the dependencies.

python3.12 -m pip install --upgrade "pyjson5" "boto3" "requests"

At this point, you may start the module in src to test or use it as a daemon. The main script of the module polls every half until there's a hit.

cd src
python3.12 -m ratsitlarm

Run it on Lambda

Build the zip bundles.

make

Using the generated bundles(lambda_function.zip and lambda_layer.zip), set up the AWS lambda function like so

  • Runtime: Python 3.12
  • Arch: arm64
  • The layer applied to the function
  • The periodic event rule attached to the function

Upon a query resulted in a hit, the module disables the event rule and publishes a message to the SNS topic before exiting.

ratsitlarm's People

Contributors

dxdxdt avatar

Watchers

 avatar

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.