goiam-python


Namegoiam-python JSON
Version 0.0.1 PyPI version JSON
download
home_pageNone
SummaryPython SDK for Go IAM - A lightweight Identity and Access Management server
upload_time2025-08-05 02:20:31
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2025 melvinodsa Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords iam authentication authorization golang python sdk
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🔐 goiam-python

[![PyPI version](https://badge.fury.io/py/goiam-python.svg)](https://badge.fury.io/py/goiam-python)
[![Python versions](https://img.shields.io/pypi/pyversions/goiam-python.svg)](https://pypi.org/project/goiam-python/)

Python SDK for Go IAM - A lightweight Identity and Access Management server.

## Installation

```bash
pip install goiam-python
# or
poetry add goiam-python
# or
pipenv install goiam-python
```

## Usage

### Initialize the SDK

```python
from goiam import new_service

service = new_service(
    base_url="https://go-iam.example.com",
    client_id="your-client-id",
    secret="your-secret"
)
```

### Verify Authentication Code

```python
try:
    token = service.verify("auth-code")
    print(f"Access Token: {token}")
except Exception as error:
    print(f"Failed to verify code: {error}")
```

### Fetch Current User Information

```python
try:
    user = service.me(token)
    print(f"User: {user.name} ({user.email})")
except Exception as error:
    print(f"Failed to fetch user information: {error}")
```

### Create a Resource

```python
from goiam import Resource

resource = Resource(
    id="resource-id",
    name="Resource Name",
    description="Resource Description",
    key="resource-key",
    enabled=True,
    project_id="project-id",
    created_by="creator",
    updated_by="updater"
)

try:
    service.create_resource(resource, token)
    print("Resource created successfully")
except Exception as error:
    print(f"Failed to create resource: {error}")
```

## Classes

The SDK provides the following main classes:

### User

```python
class User:
    id: str
    project_id: str
    name: str
    email: str
    phone: str
    enabled: bool
    profile_pic: str
    expiry: Optional[str]
    roles: Dict[str, UserRole]
    resources: Dict[str, UserResource]
    policies: Dict[str, str]
    created_at: Optional[str]
    created_by: str
    updated_at: Optional[str]
    updated_by: str
```

### Resource

```python
class Resource:
    def __init__(self,
                 id: str = '',
                 name: str = '',
                 description: str = '',
                 key: str = '',
                 enabled: bool = True,
                 project_id: str = '',
                 created_by: str = '',
                 updated_by: str = '',
                 created_at: Optional[str] = None,
                 updated_at: Optional[str] = None,
                 deleted_at: Optional[str] = None):
        # ...
```

## Error Handling

The SDK methods raise exceptions with descriptive messages. It's recommended to wrap API calls in try-except blocks:

```python
try:
    result = service.verify("code")
    # Handle success
except Exception as error:
    print(f"API Error: {error}")
    # Handle error
```

## Testing

Run the tests using:

```bash
python -m pytest python/test_service.py
# or
python -m unittest python/test_service.py
```

## Related Projects

> ✅ Admin UI: [go-iam-ui](https://github.com/melvinodsa/go-iam-ui)  
> 🐳 Docker Setup: [go-iam-docker](https://github.com/melvinodsa/go-iam-docker)  
> 🔐 Backend: [go-iam](https://github.com/melvinodsa/go-iam)  
> 📦 SDK: [go-iam-sdk](https://github.com/melvinodsa/go-iam-sdk)  
> 🚀 Examples: [go-iam-examples](https://github.com/melvinodsa/go-iam-examples)

## License

MIT

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "goiam-python",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "melvinodsa <melvinodsa@gmail.com>",
    "keywords": "iam, authentication, authorization, golang, python, sdk",
    "author": null,
    "author_email": "melvinodsa <melvinodsa@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/47/31/2bdfd7934924a1dd34ced20874d22ba1465f902cc4fee9bfd443daf5b0f5/goiam_python-0.0.1.tar.gz",
    "platform": null,
    "description": "# \ud83d\udd10 goiam-python\n\n[![PyPI version](https://badge.fury.io/py/goiam-python.svg)](https://badge.fury.io/py/goiam-python)\n[![Python versions](https://img.shields.io/pypi/pyversions/goiam-python.svg)](https://pypi.org/project/goiam-python/)\n\nPython SDK for Go IAM - A lightweight Identity and Access Management server.\n\n## Installation\n\n```bash\npip install goiam-python\n# or\npoetry add goiam-python\n# or\npipenv install goiam-python\n```\n\n## Usage\n\n### Initialize the SDK\n\n```python\nfrom goiam import new_service\n\nservice = new_service(\n    base_url=\"https://go-iam.example.com\",\n    client_id=\"your-client-id\",\n    secret=\"your-secret\"\n)\n```\n\n### Verify Authentication Code\n\n```python\ntry:\n    token = service.verify(\"auth-code\")\n    print(f\"Access Token: {token}\")\nexcept Exception as error:\n    print(f\"Failed to verify code: {error}\")\n```\n\n### Fetch Current User Information\n\n```python\ntry:\n    user = service.me(token)\n    print(f\"User: {user.name} ({user.email})\")\nexcept Exception as error:\n    print(f\"Failed to fetch user information: {error}\")\n```\n\n### Create a Resource\n\n```python\nfrom goiam import Resource\n\nresource = Resource(\n    id=\"resource-id\",\n    name=\"Resource Name\",\n    description=\"Resource Description\",\n    key=\"resource-key\",\n    enabled=True,\n    project_id=\"project-id\",\n    created_by=\"creator\",\n    updated_by=\"updater\"\n)\n\ntry:\n    service.create_resource(resource, token)\n    print(\"Resource created successfully\")\nexcept Exception as error:\n    print(f\"Failed to create resource: {error}\")\n```\n\n## Classes\n\nThe SDK provides the following main classes:\n\n### User\n\n```python\nclass User:\n    id: str\n    project_id: str\n    name: str\n    email: str\n    phone: str\n    enabled: bool\n    profile_pic: str\n    expiry: Optional[str]\n    roles: Dict[str, UserRole]\n    resources: Dict[str, UserResource]\n    policies: Dict[str, str]\n    created_at: Optional[str]\n    created_by: str\n    updated_at: Optional[str]\n    updated_by: str\n```\n\n### Resource\n\n```python\nclass Resource:\n    def __init__(self,\n                 id: str = '',\n                 name: str = '',\n                 description: str = '',\n                 key: str = '',\n                 enabled: bool = True,\n                 project_id: str = '',\n                 created_by: str = '',\n                 updated_by: str = '',\n                 created_at: Optional[str] = None,\n                 updated_at: Optional[str] = None,\n                 deleted_at: Optional[str] = None):\n        # ...\n```\n\n## Error Handling\n\nThe SDK methods raise exceptions with descriptive messages. It's recommended to wrap API calls in try-except blocks:\n\n```python\ntry:\n    result = service.verify(\"code\")\n    # Handle success\nexcept Exception as error:\n    print(f\"API Error: {error}\")\n    # Handle error\n```\n\n## Testing\n\nRun the tests using:\n\n```bash\npython -m pytest python/test_service.py\n# or\npython -m unittest python/test_service.py\n```\n\n## Related Projects\n\n> \u2705 Admin UI: [go-iam-ui](https://github.com/melvinodsa/go-iam-ui)  \n> \ud83d\udc33 Docker Setup: [go-iam-docker](https://github.com/melvinodsa/go-iam-docker)  \n> \ud83d\udd10 Backend: [go-iam](https://github.com/melvinodsa/go-iam)  \n> \ud83d\udce6 SDK: [go-iam-sdk](https://github.com/melvinodsa/go-iam-sdk)  \n> \ud83d\ude80 Examples: [go-iam-examples](https://github.com/melvinodsa/go-iam-examples)\n\n## License\n\nMIT\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2025 melvinodsa\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.\n        ",
    "summary": "Python SDK for Go IAM - A lightweight Identity and Access Management server",
    "version": "0.0.1",
    "project_urls": {
        "Documentation": "https://github.com/melvinodsa/go-iam-sdk/tree/main/python",
        "Homepage": "https://github.com/melvinodsa/go-iam-sdk",
        "Issues": "https://github.com/melvinodsa/go-iam-sdk/issues",
        "Repository": "https://github.com/melvinodsa/go-iam-sdk.git"
    },
    "split_keywords": [
        "iam",
        " authentication",
        " authorization",
        " golang",
        " python",
        " sdk"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d1339676c3182db276e34088515b6b38f1634333980c3c0f0bb1ab04fc8c1645",
                "md5": "3c894ae1004397fba6c4b29cbab9c1dd",
                "sha256": "53dc423565f5146586fc85067747809160ccb935111e76e7efe84c7a4f020296"
            },
            "downloads": -1,
            "filename": "goiam_python-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3c894ae1004397fba6c4b29cbab9c1dd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 4088,
            "upload_time": "2025-08-05T02:20:30",
            "upload_time_iso_8601": "2025-08-05T02:20:30.083551Z",
            "url": "https://files.pythonhosted.org/packages/d1/33/9676c3182db276e34088515b6b38f1634333980c3c0f0bb1ab04fc8c1645/goiam_python-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "47312bdfd7934924a1dd34ced20874d22ba1465f902cc4fee9bfd443daf5b0f5",
                "md5": "6780c5dfad11aa52ca3f085ca83aa8da",
                "sha256": "e111aa98ab29683374947cfef88a1d7245c87d345a528efaa1d66f4b5f8df4b1"
            },
            "downloads": -1,
            "filename": "goiam_python-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "6780c5dfad11aa52ca3f085ca83aa8da",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 3805,
            "upload_time": "2025-08-05T02:20:31",
            "upload_time_iso_8601": "2025-08-05T02:20:31.738574Z",
            "url": "https://files.pythonhosted.org/packages/47/31/2bdfd7934924a1dd34ced20874d22ba1465f902cc4fee9bfd443daf5b0f5/goiam_python-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-05 02:20:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "melvinodsa",
    "github_project": "go-iam-sdk",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "goiam-python"
}
        
Elapsed time: 1.82923s