An API for interacting with the Tahrir database
Project description
Tahrir-API
API for interacting with the Tahrir database. Based on the Tahrir database model written by Ralph Bean. There are two classes that can be used in this module. The first is the TahrirDatabase class located in tahrir_api.dbapi and the second is the database model located in tahrir_api.model. The TahrirDatabase class is a high level way to interact with the database. The model is used for a slightly more low level way of interacting with the database. It allows for custom interactions with the database without having to use the TahrirDatabase class.
Creating a Badge
This is an example of creating a badge via Tahrir-API:
from tahrir_api.dbapi import TahrirDatabase
db = TahrirDatabase('backend://badges:badgesareawesome@localhost/badges')
origin = 'http://foss.rit.edu/badges'
issuer_name = 'FOSS@RIT'
org = 'http://foss.rit.edu'
contact = 'foss@rit.edu'
issuer_id = db.add_issuer(origin, issuer_name, org, contact)
badge_name = 'fossbox'
image = 'http://foss.rit.edu/files/fossboxbadge.png'
desc = 'Welcome to the FOSSBox. A member is you!'
criteria = 'http://foss.rit.edu'
db.add_badge(badge_name, image, desc, criteria, issuer_id)
Awarding a Badge
This is an example of awarding a badge via Tahrir-API:
from tahrir_api.dbapi import TahrirDatabase
db = TahrirDatabase('backend://badges:badgesareawesome@localhost/badges')
badge_id = 'fossbox'
person_email = 'person@email.com'
issued_on = None
db.add_person(person_email)
db.add_assertion(badge_id, person_email, issued_on)
Development
Set-up your env
Install helper
$ sudo dnf install -y python3-virtualenvwrapper # RedHat-based OS
Build your virtual env
$ export WORKON_HOME=$HOME/.virtualenvs
$ mkvirtualenv tahrir-api
Connect w/ your virutal env
$ workon tahrir-api
(tahrir-api)$
Install
Requirements
(tahrir-api)$ pip install -r requirements.txt
Project installation
(tahrir-api)$ python setup.py develop
Happy hacking!
Run the tests
You can run the tests with tox
(tahrir-api)$ pip install tox
(tahrir-api)$ tox
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file tahrir_api-1.1.5.tar.gz
.
File metadata
- Download URL: tahrir_api-1.1.5.tar.gz
- Upload date:
- Size: 33.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65e693c39363b5e2614116f88290974e4d2a17091b8e59a095a398067493d1a3 |
|
MD5 | 3d9941c8a255f18e1c7133c777a9a256 |
|
BLAKE2b-256 | 4766e590e6dfd42127910cb46d8ce5870f03b644ee767ac462882d9e2f0c9110 |
File details
Details for the file tahrir_api-1.1.5-py3-none-any.whl
.
File metadata
- Download URL: tahrir_api-1.1.5-py3-none-any.whl
- Upload date:
- Size: 39.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5390f53942e2676119936a21e5d49c32f20a021f2630a02ff3b7be0d6248da1b |
|
MD5 | 72ff7231902816f1228ca019e18e5a69 |
|
BLAKE2b-256 | 416502225450566a69c300341eb6dacdb49ee1414412ed7e6774cf231722c4f7 |