Skip to main content

Python SDK for ContactsManager API authentication and token generation

Project description

ContactsManager Python SDK

A Python SDK for the ContactsManager API that handles authentication and token generation.

Installation

pip install contactsmanager

Usage

from contactsmanager import ContactsManagerClient

# Initialize the client
client = ContactsManagerClient(
    api_key="your_api_key",
    api_secret="your_api_secret",
    org_id="your_org_id"
)

# Generate a token for a user
token_response = client.generate_token(
    user_id="user123",
    device_info={  # Optional
        "device_type": "mobile",
        "os": "iOS",
        "app_version": "1.0.0"
    }
)

print(f"Token: {token_response['token']}")
print(f"Expires at: {token_response['expires_at']}")

Features

  • Simple API for generating JWT tokens
  • Type hints for better IDE support
  • Comprehensive test coverage
  • Support for custom token expiration

Advanced Usage

Custom Token Expiration

By default, tokens expire after 24 hours (86400 seconds). You can customize this:

# Generate a token that expires in 1 hour
token_response = client.generate_token(
    user_id="user123",
    expiration_seconds=3600  # 1 hour
)

Requirements

  • Python 3.8+
  • PyJWT>=2.0.0

Development

Setting up development environment

# Clone the repository
git clone https://github.com/arpwal/contactmanager.git
cd contactmanager/sdk/py

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

License

MIT License

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

contactsmanager-0.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

contactsmanager-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file contactsmanager-0.1.0.tar.gz.

File metadata

  • Download URL: contactsmanager-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for contactsmanager-0.1.0.tar.gz
Algorithm Hash digest
SHA256 087e7236867d3b2107153b2b2b91bc6c31cbe3a7d046e10f8a2a6ec49e69e450
MD5 25dcc90ee61b0c9188352928d081d079
BLAKE2b-256 4fde89b8f1f977e01b3c32a7ff8753bbc3fa5db233b81ab1721eec483b12f967

See more details on using hashes here.

File details

Details for the file contactsmanager-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for contactsmanager-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dca6606bc2a1eabdd4b9c7e2300dcd5d671cb030991fab9d9cfcda6e4fb0cb31
MD5 702293676683aa62a4152c3be662e208
BLAKE2b-256 fcc9859c0c950472e6787b938026dc910034a414a6290a2bda11e8c4b28a6c24

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