geofront.backends.dbapi — Key store using DB-API 2.0

See also

PEP 249 — Python Database API Specification v2.0

New in version 0.2.0.

class geofront.backends.dbapi.DatabaseKeyStore(db_module: module, *args, **kwargs) → None

Store public keys into database through DB-API 2.0. It takes a module that implements DB-API 2.0, and arguments/keywords to its connect() method. For example, the following code stores public keys into SQLite 3 database:

import sqlite3
DatabaseKeyStore(sqlite3, 'geofront.db')

The following code stores public keys into PostgreSQL database through psycopg2:

import psycopg2
DatabaseKeyStore(psycopg2, database='geofront', user='postgres')

It will create a table named geofront_public_key into the database.

  • db_module (types.ModuleType) – PEP 249 DB-API 2.0 compliant module
  • *args – arguments to db_module.connect() function
  • *kwargs – keyword arguments to db_module.connect() function