Skip to main content

Automate awarding Badgr (or equivalent) badges to recipients without the overhead of badgr-server

Project description

badgr-lite

Automate awarding Open Badges to recipients without the overhead of a server

PyPI Status Build Status Code Coverage Status Documentation Status Updates

Quick Start

Manage your badges (with Badgr ), but automate the award and retrieval of badges with badger-lite.

  1. Create an account on either Badgr or an equivalent server.

  2. Use your Badgr (or equivalent) username and password to generate OAuth tokens for use with your project:

curl -X POST 'https://api.badgr.io/o/token' -d "username=YOUREMAIL&password=YOURPASSWORD" > token.json
  1. Install the badgr-lite package:

pip install badgr-lite

Or (using the newly recommended way from Python.org:

pipenv install badgr-lite

Now you can award badges through either the Command Line (CLI) or Library (SDK).

Command Line Example

Sample Command Help:

$ badgr --help
Usage: badgr [OPTIONS] COMMAND [ARGS]...

  Automate Badgr tasks without the overhead of badgr-server

Options:
  --token-file PATH  File holding token credentials
  --help             Show this message and exit.

Commands:
  award-badge  Award badge with BADGE_ID to RECIPIENT.
  list-badges  Pull and print a list of badges from server

--token-file can be omitted if token.json filename is in current directory.

$ badgr --token-file token.json list-badges

dTjxL52HQBiSgIp5JuVq5w  https://badgr.io/public/assertions/dTjxL52HQBiSgIp5JuVq5w       Bay Area Python Interest Group TDD Participant
6YhFytMUQb2loOMEy63gQA  https://badgr.io/public/assertions/6YhFytMUQb2loOMEy63gQA       Bay Area Python Interest Group TDD Quizmaster
zzExTDvOTnOx_R3YhwPf3A  https://badgr.io/public/assertions/zzExTDvOTnOx_R3YhwPf3A       Test Driven Development Fundamentals Champion
zNjcY70FSn603SO9vMGhBA  https://badgr.io/public/assertions/zNjcY70FSn603SO9vMGhBA       Install Python with Virtual Environments
ZN0CIo4NR7-GgrliDJzoTw  https://badgr.io/public/assertions/ZN0CIo4NR7-GgrliDJzoTw       Fivvr badge
$ badgr --token-file token.json award-badge --badge-id 2TfNNqMLT8CoAhfGKqSv6Q --recipient recipient@example.com

IfK18iLWSNWhvnQxLPHSxA  https://badgr.io/public/assertions/IfK18iLWSNWhvnQxLPHSxA       <No name>

Library Examples

One could patch together curl commands to interact with the Badgr server (although badgr-lite does make it much faster to get started). However, the real benefit of Badgr-Lite is directly using its library in whatever tool that you are using to automate award assignments (e.g., Django server, Flask server, etc.).

>>> from badgr_lite.models import BadgrLite
>>> badge_id = '2TfNNqMLT8CoAhfGKqSv6Q'
>>> badge_data = {
...     "recipient": {
...         "identity": "recipient@example.com",
...     },
... }
>>> badgr = BadgrLite(token_filename='./token.json')
>>> badge = badgr.award_badge(badge_id, badge_data)
>>> print(badge)
q8nKaXMHTICZj7qhKEwutg  https://badgr.io/public/assertions/q8nKaXMHTICZj7qhKEwutg      <No name>

Purpose

Open Badges are images with credential data baked into them. They are liked a digitally signed certificate that is also an image that can be displayed on the web. They can be validated for authenticity and are a nice award to grant to people for jobs well done, passing quizzes and much more.

Mozilla recently partnered with Concentric Sky. They built Badgr which makes badge management so much easier (and less buggy).

At the time this project was created, however, there was no easy way to automate the award of badges (e.g., on your own website) without having to build a full and complicated badgr-server of your own.

This badgr-lite project solves that problem.

Tutorial

If you are new to Open Badges and want to see how to use them (and automate them with this project), go to this tutorial.

History

1.0.2 (2019-11-22)

1.0.1 (2019-11-22)

1.0.0 (2019-10-03)

0.0.1 (2019-09-26)

  • First release on PyPI.

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

badgr_lite-1.0.2.tar.gz (32.9 kB view details)

Uploaded Source

Built Distribution

badgr_lite-1.0.2-py2.py3-none-any.whl (10.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file badgr_lite-1.0.2.tar.gz.

File metadata

  • Download URL: badgr_lite-1.0.2.tar.gz
  • Upload date:
  • Size: 32.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.8.0

File hashes

Hashes for badgr_lite-1.0.2.tar.gz
Algorithm Hash digest
SHA256 af68897777054d80745c916de485946d9926b062a7aaa392ae717a1b8eb701f9
MD5 9078de3166b38cf2c95dd7135e4db76a
BLAKE2b-256 5ffad102143fe5805d88cbd471dfc07d8b388ab52aef00331037f95471a2fe81

See more details on using hashes here.

File details

Details for the file badgr_lite-1.0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: badgr_lite-1.0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.8.0

File hashes

Hashes for badgr_lite-1.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1873d1fd4440eff0475ede398f52d5458d4e15b9180e48999f7ff7eedec65283
MD5 a7e6522a37ad94906c1f8391d54ad190
BLAKE2b-256 29e38e4c8d39f6063a91cbeef4d2fd6990a9826523053e8b498d9108d809b5fb

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