Skip to main content

Python SDK for digital badge and certificate generation. Create, issue, and manage digital certificates and badges at scale.

Project description

Digital Badge - Python Certificate Generator SDK

PyPI version Python Versions License: MIT

Official Python SDK for digital badge and certificate generation. Create, issue, and manage digital certificates and badges programmatically with the Issue Badge API.

Features

  • Certificate Generator - Create professional digital certificates programmatically
  • Bulk Certificate Generation - Issue certificates to multiple recipients at scale
  • Badge Creator - Design and issue digital badges for achievements
  • Custom Fields - Add custom metadata like scores, dates, employee IDs
  • Image Upload - Attach photos or images to certificates (Base64)
  • Expiration Management - Set expiration dates for time-limited credentials
  • Idempotent Operations - Safe retry logic with idempotency keys
  • Type Hints - Full type annotation support for better IDE integration

Installation

pip install digitalbadge

Quick Start

from issuebadge import IssueBadge

# Initialize the client
client = IssueBadge('YOUR_API_TOKEN')

# Issue a certificate
result = client.issue_badge({
    'badge_id': 'your_badge_template_id',
    'name': 'John Doe',
    'email': 'john@example.com',
    'idempotency_key': 'unique_key_12345'
})

print(f"Certificate URL: {result['publicUrl']}")

Use Cases

  • Training Certificates - Automatically issue completion certificates for online courses
  • Employee Recognition - Generate achievement badges for HR programs
  • Event Certificates - Bulk generate attendance certificates for webinars and conferences
  • Academic Credentials - Issue digital diplomas and course completion certificates
  • Professional Certifications - Create verifiable professional credentials
  • Competition Awards - Generate winner certificates and participation badges

API Reference

Initialize Client

from issuebadge import IssueBadge

# Basic initialization
client = IssueBadge('YOUR_API_TOKEN')

# With custom settings
client = IssueBadge(
    api_token='YOUR_API_TOKEN',
    api_url='https://app.issuebadge.com',  # Optional: custom API URL
    timeout=60  # Optional: request timeout in seconds
)

Validate API Key

result = client.validate_key()
print(f"Valid: {result.get('valid')}")

Create Badge Template

result = client.create_badge({
    'name': 'Python Developer Certification',
    'description': 'Certified Python Developer badge'
})
badge_id = result['badge_id']

Get All Badge Templates

badges = client.get_all_badges()
for badge in badges.get('data', []):
    print(f"{badge['name']}: {badge['badge_id']}")

Issue Certificate

# Basic certificate
result = client.issue_badge({
    'badge_id': 'abc123',
    'name': 'John Doe',
    'email': 'john@example.com',
    'idempotency_key': 'unique_key_12345'
})
print(f"Certificate: {result['publicUrl']}")

Issue Certificate with Expiration

from datetime import datetime, timedelta

# Certificate valid for 2 years
expire_date = (datetime.now() + timedelta(days=730)).strftime('%Y-%m-%d')

result = client.issue_badge({
    'badge_id': 'abc123',
    'name': 'Jane Smith',
    'email': 'jane@example.com',
    'expire_date': expire_date,
    'idempotency_key': 'cert_jane_2024'
})

Issue Certificate with Custom Fields

result = client.issue_badge({
    'badge_id': 'abc123',
    'name': 'Bob Wilson',
    'email': 'bob@example.com',
    'idempotency_key': 'cert_bob_001',
    'metadata': {
        'course_name': 'Advanced Python Programming',
        'score': 95,
        'completion_date': '2024-11-15',
        'instructor': 'Dr. Smith',
        'certificate_number': 'CERT-2024-001'
    }
})

Issue Certificate with Photo

import base64

# Read and encode image
with open('recipient_photo.jpg', 'rb') as image_file:
    image_data = base64.b64encode(image_file.read()).decode('utf-8')
    photo_base64 = f'data:image/jpeg;base64,{image_data}'

result = client.issue_badge({
    'badge_id': 'abc123',
    'name': 'Alice Johnson',
    'email': 'alice@example.com',
    'idempotency_key': 'cert_alice_photo',
    'metadata': {
        'certificate_photo': photo_base64
    }
})

Bulk Certificate Generation

# Issue certificates to multiple recipients
recipients = [
    {'name': 'John Doe', 'email': 'john@example.com', 'idempotency_key': 'bulk_1'},
    {'name': 'Jane Smith', 'email': 'jane@example.com', 'idempotency_key': 'bulk_2'},
    {'name': 'Bob Wilson', 'email': 'bob@example.com', 'idempotency_key': 'bulk_3'},
]

results = client.issue_badges_bulk('your_badge_id', recipients)

for result in results:
    if result['success']:
        print(f"Issued: {result['publicUrl']}")
    else:
        print(f"Failed: {result['error']}")

Webhook-Style Issuance (GET)

# Issue via GET request (useful for webhooks)
result = client.issue_badge_get({
    'badge_id': 'abc123',
    'name': 'John Doe',
    'email': 'john@example.com',
    'idempotency_key': 'webhook_123'
})

Error Handling

try:
    result = client.issue_badge({
        'badge_id': 'abc123',
        'name': 'John Doe',
        'email': 'john@example.com'
    })
    print(f"Success: {result['publicUrl']}")
except Exception as e:
    print(f"Error: {str(e)}")

Requirements

  • Python 3.6 or higher
  • requests library (installed automatically)

Links

Support

License

MIT License - see LICENSE for details.

Keywords

certificate generator, bulk certificate generator, digital badge, digital certificate, badge generator, certificate maker, certificate creator, credential management, certificate automation, online certificate, e-certificate, training certificate, course certificate, verifiable credentials, open badge, badge API, certificate API

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

digitalbadge-1.0.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

digitalbadge-1.0.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file digitalbadge-1.0.0.tar.gz.

File metadata

  • Download URL: digitalbadge-1.0.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for digitalbadge-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6a72c36453702c5f64a0014af34841c6cb71e8ddbe3e69196358d284d8911a8f
MD5 387de6452fb3760f688f7273e343f8ed
BLAKE2b-256 66412e7ecf860c5052dc6572efa2140c5961f2a6aa0df9ce57326a02c1cff60f

See more details on using hashes here.

File details

Details for the file digitalbadge-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: digitalbadge-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for digitalbadge-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 677657f7d840fca8f2610aaac5693b202f69c7d7182499ee45579b0ad7b6c6b5
MD5 210ce5d0235adb51f565b325177946a5
BLAKE2b-256 5eb6db3cc10138d050589338169c9956c996291f020b73cd65b6a8ccbb6d2834

See more details on using hashes here.

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