Skip to main content

Official Python SDK for the ME-QR API

Project description

ME-QR Python SDK

Official Python client for the ME-QR API.

Requirements

  • Python 3.9+
  • httpx (optional, recommended) or standard urllib

Installation

pip install me-qr
# with faster HTTP client (recommended):
pip install "me-qr[httpx]"

Or copy me_qr.py directly into your project.

Quick Start

from me_qr import MEQRClient

client = MEQRClient(token="YOUR_API_TOKEN")

# URL QR code → save to file
result = client.create_link("https://me-qr.com")
result.save("qr.png")

# Get as data URL for web embedding
print(result.to_data_url())  # data:image/png;base64,...

Usage

Run the example

python example.py

URL QR code

result = client.create_link("https://example.com")
result.save("link.png")

Styled QR code

from me_qr import QROptions

options = QROptions(
    size=600,
    foreground_color="#2563eb",
    background_color="#f8fafc",
    error_correction="H",
)
result = client.create_link("https://me-qr.com", format="svg", options=options)
result.save("styled.svg")

Wi-Fi QR code

from me_qr import WIFI_ENC_WPA  # 'wpa/wpa2'

result = client.create_wifi(
    ssid="MyNetwork",
    password="secret",
    encryption=WIFI_ENC_WPA,  # 'wpa/wpa2' | 'wpa3' | 'wep' | 'none' | 'raw'
)
result.save("wifi.png")

vCard QR code

result = client.create_vcard(
    name="Alex",
    last_name="Smith",
    phones=[{"phone": "+1234567890", "type": 0}],  # type: 0=general, 1=work
    emails=[{"email": "alex@example.com", "type": 0}],  # type: 0=general, 1=corporate
    organization="ACME Corp",
)
result.save("vcard.png")

Email QR code

result = client.create_email(
    email="support@example.com",
    subject="Hello",
    body="Message body",
)
result.save("email.png")

Plain text QR code

result = client.create_text("Hello, World!")
result.save("text.png")

Full control (create)

from me_qr import QRType

result = client.create(
    qr_type=QRType.WIFI,
    title="Office Wi-Fi",
    qr_fields_data={"ssid": "Corp", "password": "pass", "encryption": "wpa/wpa2"},
    format="svg",
)

QR Type IDs (QRType enum)

Value ID Description
QRType.LINK 1 URL / website
QRType.PDF 4 PDF document
QRType.EMAIL 5 Email
QRType.VCARD 7 Contact card
QRType.APP_STORE 8 App Store / Play
QRType.WHATSAPP 9 WhatsApp
QRType.AUDIO 10 Audio file
QRType.MAP 11 GPS location
QRType.TEXT 15 Plain text
QRType.IMAGE 16 Image gallery
QRType.WIFI 17 Wi-Fi credentials
QRType.PHONE 27 Phone call
QRType.SMS 28 SMS
QRType.VIDEO 29 Video

Error Handling

from me_qr import MEQRError

try:
    result = client.create_link("https://example.com")
except MEQRError as e:
    print(f"Error {e.status_code}: {e}")
    print(e.response)

Output Formats

Format Use case
png Print, web, general use
jpeg Smaller file size
svg High-resolution / infinite scale
json Raw QR matrix data

Links


License

MIT © ME-QR

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

me_qr-1.0.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

me_qr-1.0.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: me_qr-1.0.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for me_qr-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4dff981f96f757048a2c0ff910439607c9be92e5a984d5e535e70b27217ecaec
MD5 d10782b5825bab21c262c0ea8dad0b08
BLAKE2b-256 c3d79d2f81c3cad539a090752b4b8d3541030ebaabb269643c95537a4083792d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: me_qr-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for me_qr-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be3820806fcaef8f8fcd9c97eec538cdf45544c8f76e9d4daee107ac0f000737
MD5 e78c83539dc1e4debc372371f7ddbfd0
BLAKE2b-256 668449b826a313d330a7d862f17e3b9442fd52e58cee19b50cab69063cc599eb

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