msantino / publish-event-sns

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python 3.7 PyPI version License: MIT Twitter Follow

Publish Data Event to SNS Topic

This package helps you to publish a dict object as JSON into SNS Topic, including fields as attributes

pip install publish-event-sns
from publish_event_sns import publish


my_dict = {
    "foo": "bar"
}

response = publish("topic_name", my_dict)

This code will transform DICT into JSON and publish into SNS Topic with foo as attribute as bar value.

publish function will automaticaly exclude from attributes non primitive values (dict, object, etc)

Parameters

Some aditional configuration is possible while publishing event:

  • region_name: Region name to use in internal boto3 client;
  • session: If you need to provide a existing boto3 session
  • attr_exclude: A list of fields to force exclusion while including fields as attributes

About

License:MIT License


Languages

Language:Python 100.0%