Skip to main content

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

Project description

Issue Badge Logo

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.1.tar.gz (7.6 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.1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: digitalbadge-1.0.1.tar.gz
  • Upload date:
  • Size: 7.6 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.1.tar.gz
Algorithm Hash digest
SHA256 b27770cf7289c878039d03add4401bada5330bdd0001834cb6e4e284581e1194
MD5 83d929ae6de8e171d99bc69a0b9f9d2d
BLAKE2b-256 453066e64b6fa248f84e265681bca1464acba39009113f01931673ef5984f42c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: digitalbadge-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.9 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1502bfffa608d615644c046d38a4b6fde553facc8e7d3a0d4388f216808de696
MD5 9b0d6c64d611a4dd085430a68d7688d7
BLAKE2b-256 237ef0b5160f73cbf59fb680adc468672f9dbdd4db64287947ef0298ffdbfc84

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