Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tahrir_api-1.1.1.tar.gz (33.5 kB view details)

Uploaded Source

Built Distribution

tahrir_api-1.1.1-py3-none-any.whl (39.2 kB view details)

Uploaded Python 3

File details

Details for the file tahrir_api-1.1.1.tar.gz.

File metadata

  • Download URL: tahrir_api-1.1.1.tar.gz
  • Upload date:
  • Size: 33.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for tahrir_api-1.1.1.tar.gz
Algorithm Hash digest
SHA256 034e21bccccfdc2c38c3d293b4ce0dc6e604eee4a09b37ea474959c4487aca22
MD5 c7c07362c47d6b548a45d3c03f08da27
BLAKE2b-256 ce8ea75400e17018caa1033965645ffaccfd11912aa58bafdd5b7182fa86427c

See more details on using hashes here.

File details

Details for the file tahrir_api-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: tahrir_api-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 39.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for tahrir_api-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 556272783adb36e0c96ed566175ba72460bfbd660e8412536d934c73b6550540
MD5 64f61d12ca1562e2d849144224fe101b
BLAKE2b-256 c0da29a11d74854ec9872f1e708d99d6da20ea40d1f88247e82ac902e3e613fb

See more details on using hashes here.

Supported by

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