# ContactsManager Python SDK
A Python SDK for the ContactsManager API that handles authentication and token generation.
## Installation
```bash
pip install contactsmanager
```
## Usage
```python
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:
```python
# 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
```bash
# 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
```
### Releasing new versions
The SDK uses an automated process for releases:
1. Update the version in `contactsmanager/__init__.py` using the provided script:
```bash
./bump_version.sh 0.1.1
```
2. Commit and push the change to the main branch:
```bash
git add contactsmanager/__init__.py
git commit -m "Bump version to 0.1.1"
git push origin main
```
3. The GitHub Actions workflow will:
- Run all tests across multiple Python versions
- Create a new GitHub release with the version tag
- Build and publish the package to PyPI
Alternatively, you can manually create a new release by:
1. Creating and pushing a git tag:
```bash
git tag -a v0.1.1 -m "Release version 0.1.1"
git push origin v0.1.1
```
2. The GitHub Actions workflow will handle the rest
## License
MIT License
Raw data
{
"_id": null,
"home_page": "https://github.com/arpwal/contactsmanager-py",
"name": "contactsmanager",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "api, sdk, contactsmanager, authentication, jwt",
"author": "Arpit Agarwal",
"author_email": "your-email@example.com",
"download_url": "https://files.pythonhosted.org/packages/de/84/e70c0639c79d88edccee6b4ce9b2f08b0c449ab51a14dcf234fb8f6b2300/contactsmanager-1.1.0.tar.gz",
"platform": null,
"description": "# ContactsManager Python SDK\n\nA Python SDK for the ContactsManager API that handles authentication and token generation.\n\n## Installation\n\n```bash\npip install contactsmanager\n```\n\n## Usage\n\n```python\nfrom contactsmanager import ContactsManagerClient\n\n# Initialize the client\nclient = ContactsManagerClient(\n api_key=\"your_api_key\",\n api_secret=\"your_api_secret\",\n org_id=\"your_org_id\"\n)\n\n# Generate a token for a user\ntoken_response = client.generate_token(\n user_id=\"user123\",\n device_info={ # Optional\n \"device_type\": \"mobile\",\n \"os\": \"iOS\",\n \"app_version\": \"1.0.0\"\n }\n)\n\nprint(f\"Token: {token_response['token']}\")\nprint(f\"Expires at: {token_response['expires_at']}\")\n```\n\n## Features\n\n- Simple API for generating JWT tokens\n- Type hints for better IDE support\n- Comprehensive test coverage\n- Support for custom token expiration\n\n## Advanced Usage\n\n### Custom Token Expiration\n\nBy default, tokens expire after 24 hours (86400 seconds). You can customize this:\n\n```python\n# Generate a token that expires in 1 hour\ntoken_response = client.generate_token(\n user_id=\"user123\",\n expiration_seconds=3600 # 1 hour\n)\n```\n\n## Requirements\n\n- Python 3.8+\n- PyJWT>=2.0.0\n\n## Development\n\n### Setting up development environment\n\n```bash\n# Clone the repository\ngit clone https://github.com/arpwal/contactmanager.git\ncd contactmanager/sdk/py\n\n# Install development dependencies\npip install -e \".[dev]\"\n\n# Run tests\npytest\n```\n\n### Releasing new versions\n\nThe SDK uses an automated process for releases:\n\n1. Update the version in `contactsmanager/__init__.py` using the provided script:\n ```bash\n ./bump_version.sh 0.1.1\n ```\n\n2. Commit and push the change to the main branch:\n ```bash\n git add contactsmanager/__init__.py\n git commit -m \"Bump version to 0.1.1\"\n git push origin main\n ```\n\n3. The GitHub Actions workflow will:\n - Run all tests across multiple Python versions\n - Create a new GitHub release with the version tag\n - Build and publish the package to PyPI\n\nAlternatively, you can manually create a new release by:\n\n1. Creating and pushing a git tag:\n ```bash\n git tag -a v0.1.1 -m \"Release version 0.1.1\"\n git push origin v0.1.1\n ```\n\n2. The GitHub Actions workflow will handle the rest\n\n## License\n\nMIT License \n",
"bugtrack_url": null,
"license": null,
"summary": "Python SDK for ContactsManager API authentication and token generation",
"version": "1.1.0",
"project_urls": {
"Bug Reports": "https://github.com/arpwal/contactmanager/issues",
"Homepage": "https://github.com/arpwal/contactsmanager-py",
"Source": "https://github.com/arpwal/contactmanager"
},
"split_keywords": [
"api",
" sdk",
" contactsmanager",
" authentication",
" jwt"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "17507c08dfb7ab769cfad534ca014a82f76cf86a6b13c7dbd0ec1b9782609959",
"md5": "d07aa7cad7ef4fb97ec8487de54b5daa",
"sha256": "280dbcc59a220e6ce8ae33c0251cff7956207195c46e3b784139e1eb00893618"
},
"downloads": -1,
"filename": "contactsmanager-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d07aa7cad7ef4fb97ec8487de54b5daa",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 4665,
"upload_time": "2025-03-19T03:38:34",
"upload_time_iso_8601": "2025-03-19T03:38:34.993738Z",
"url": "https://files.pythonhosted.org/packages/17/50/7c08dfb7ab769cfad534ca014a82f76cf86a6b13c7dbd0ec1b9782609959/contactsmanager-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "de84e70c0639c79d88edccee6b4ce9b2f08b0c449ab51a14dcf234fb8f6b2300",
"md5": "65f2853c4f06c42a5d3dd52c73ca9fb2",
"sha256": "159f355a7f0b78e9b8c8502bfedbee14ee40bb289d2db4a11e79d90b3b6059b3"
},
"downloads": -1,
"filename": "contactsmanager-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "65f2853c4f06c42a5d3dd52c73ca9fb2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 4785,
"upload_time": "2025-03-19T03:38:37",
"upload_time_iso_8601": "2025-03-19T03:38:37.110714Z",
"url": "https://files.pythonhosted.org/packages/de/84/e70c0639c79d88edccee6b4ce9b2f08b0c449ab51a14dcf234fb8f6b2300/contactsmanager-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-03-19 03:38:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "arpwal",
"github_project": "contactsmanager-py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "PyJWT",
"specs": [
[
"<",
"3.0.0"
],
[
">=",
"2.0.0"
]
]
},
{
"name": "pytest",
"specs": [
[
">=",
"7.0.0"
]
]
},
{
"name": "pytest-cov",
"specs": [
[
">=",
"4.0.0"
]
]
},
{
"name": "black",
"specs": [
[
">=",
"23.0.0"
]
]
},
{
"name": "isort",
"specs": [
[
">=",
"5.12.0"
]
]
},
{
"name": "twine",
"specs": [
[
">=",
"4.0.0"
]
]
},
{
"name": "build",
"specs": [
[
">=",
"0.10.0"
]
]
}
],
"lcname": "contactsmanager"
}