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.4.3.tar.gz (37.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tahrir_api-1.4.3-py3-none-any.whl (41.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tahrir_api-1.4.3.tar.gz
  • Upload date:
  • Size: 37.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tahrir_api-1.4.3.tar.gz
Algorithm Hash digest
SHA256 4a5cd540b3f573f40564820f8fe365e7931ed12206cb17ae7c54d7bf433615bd
MD5 9adf1a019d2d0c94541215177716bf83
BLAKE2b-256 085e122af4edd0077cbe4acc0bf48880add788509a805e0c2968213bc48b20a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for tahrir_api-1.4.3.tar.gz:

Publisher: main.yml on fedora-infra/tahrir-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: tahrir_api-1.4.3-py3-none-any.whl
  • Upload date:
  • Size: 41.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tahrir_api-1.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cbcc1e76253e26f7a148dc8f391e20bfecf1302f7a603d8b805cca4c2fa946ec
MD5 0b117da5a33f4370c87d258954241e5d
BLAKE2b-256 1d33ac9634429bac31539e90836286e3c1346777c796faa5bbc781d6394f18d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for tahrir_api-1.4.3-py3-none-any.whl:

Publisher: main.yml on fedora-infra/tahrir-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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