Code Monkey home page Code Monkey logo

flask-boto3's Introduction

flask-boto3

Circle CI PyPI version

Flask extension that ties boto3 connectors to the application context.

Install

  • Via the cheeseshop

    $ pip install flask-boto3
  • Locally

    $ git clone [email protected]:Ketouem/flask-boto3.git
    $ cd flask-boto3
    flask-boto3 $ pip install .

How-to

The main class flask_boto3.Boto3 takes a Flask application as its contructor's parameter:

from flask import Flask
from flask_boto3 import Boto3
app = Flask(__name__)
app.config['BOTO3_SERVICES'] = ['s3']
boto_flask = Boto3(app)

Then boto3's clients and resources will be available as properties within the application context:

>>> with app.app_context():
        print(boto_flask.clients)
        print(boto_flask.resources)
{'s3': <botocore.client.S3 object at 0x..>}
{'s3': s3.ServiceResource()}

Configuration

flask-boto3 uses several keys from a Flask configuration objects to customize its behaviour:

  • BOTO3_ACCESS_KEY & BOTO3_SECRET_KEY : holds the AWS credentials, if None the extension will rely on boto3's default credentials lookup.
  • BOTO3_REGION : holds the region that will be used for all connectors.
  • BOTO3_PROFILE : holds the AWS profile.
  • BOTO3_SERVICES : holds, as a list, the name of the AWS resources you want to use (e.g. ['sqs', 's3']).
  • BOTO3_OPTIONAL_PARAMS : useful when you need to pass additional parameters to the connectors (e.g. for testing purposes), the format is a dict where the top-level keys are the name of the services you're using and for each the value is a dict containing to keys args (contains the parameters as tuple) and kwargs (contains the parameters as a dict when they should be passed as keyword arguments).

flask-boto3's People

Contributors

boroivanov avatar ketouem avatar

Watchers

 avatar  avatar  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.