Skip to main content

Cloud Services in Flask

Project description

Cloud Services

PIP package to provide cloud services.

Package installation

  • Installation
    $ pip3 install flask-cloud-services
    

Configuration

Define the following environment variables:

  • (str) Provider. Allowed: [aws, ]

      CLOUD_SERVICES_PROVIDER=
    

Aws Config

  • (str) Region. Example: 'us-west-2'

      CLOUD_SERVICES_AWS_REGION=
    
  • (str) Credentials: Access Key.

      AWS_ACCESS_KEY_ID=
    
  • (str) Credentials: Secret Key.

      AWS_SECRET_ACCESS_KEY=
    

How to use

AWS Services

Notifications Channel

Subscribe and Listen Notifications

Define your route where you want listen the Notification Channel and you decorate it.

from flask import Blueprint
from flask_cloud_services import notifications_listener

routes_bus = Blueprint('routes_bus', __name__)

@routes_bus.route('/notification-channel', methods=['GET', 'POST', 'PUT'])
@notifications_listener
def aws_sns(data_listener):
    any_topic_arn = "arn:aws:sns:us-west-2:test:test"
    if data_listener.topic_arn == any_topic_arn:
        pass # DO SOMETHING
Publish Events

If you want publish an event to specific channel, you just must call the function publish send it topic_arn and message encoded.

from flask_cloud_services import notifications_publisher

result = notifications_publisher(
    topic_arn="arn:aws:sns:us-west-2:test:test",
    message="{\"data\": \"value\"}"
)

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

flask_cloud_services-0.1.1.tar.gz (5.1 kB view details)

Uploaded Source

File details

Details for the file flask_cloud_services-0.1.1.tar.gz.

File metadata

  • Download URL: flask_cloud_services-0.1.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9

File hashes

Hashes for flask_cloud_services-0.1.1.tar.gz
Algorithm Hash digest
SHA256 81b695b2cbbddff83deadebf589e0e0dec10a93f49bd8d4fa57999ca822bf1f4
MD5 38b3364f3ce6f0e1f89462161af029b8
BLAKE2b-256 0e50c1bb21dc8df772dcb565e4081c2f60490e14397573066e63d973da4abbf7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page