Skip to content

Flask extension for work with GnuPG based on python-gnupg.

License

Notifications You must be signed in to change notification settings

EldarAliiev/flask-gnupg

Repository files navigation

Flask-GnuPG

https://travis-ci.org/EldarAliiev/flask-gnupg.svg?branch=master https://coveralls.io/repos/github/EldarAliiev/flask-gnupg/badge.svg?branch=master https://api.codeclimate.com/v1/badges/2ecaab472f918efb3bab/maintainability https://api.codeclimate.com/v1/badges/2ecaab472f918efb3bab/test_coverage

Flask extension for work with GnuPG based on python-gnupg.

https://github.com/EldarAliiev/flask-gnupg

Install:

$ git clone https://github.com/EldarAliiev/flask-gnupg.git
$ cd flask-gnupg
$ python setup.py install

or with pip:

$ pip install Flask-GnuPG

Usage example:

Set up configuration in your Flask application:

  • GPG_HOME_DIR : default '~/.gnupg'
  • GPG_BINARY : default 'gpg2'
  • GPG_KEYRING : default None
  • GPG_SECRET_KEYRING : default None
  • GPG_KEY_ID : default ''
  • GPG_PASSPHRASE : default ''

Create the application and initialize GnuPG instance:

from flask import Flask
from flask_gnupg import GnuPG

app = Flask(__name__)
gpg = GnuPG(app)

Or you can set up GnuPG instance later:

gpg = GnuPG()

app = Flask(__name__)
gpg.init_app(app)

Then you can use GnuPG engine in your views:

@app.route('/')
def index():
    keys_list = gpg.list_keys()
    return keys_list

For details about all allowed methods read the docs of python-gnupg library.