aleph-message


Namealeph-message JSON
Version 0.6.1 PyPI version JSON
download
home_pageNone
SummaryAleph.im message specification
upload_time2025-02-18 11:31:20
maintainerNone
docs_urlNone
authorNone
requires_python>=3
licenseMIT License Copyright (c) 2021 OKESO 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
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Aleph.im Message Specification

This library aims to provide an easy way to create, update and manipulate 
messages from Aleph.im.

It mainly consists in [pydantic](https://pydantic-docs.helpmanual.io/) 
models that provide field type validation and IDE autocompletion for messages.

This library provides:
* schema validation when parsing messages.
* cryptographic hash validation that the `item_hash` matches the content of the message.
* type validation using type checkers such as [mypy](https://www.mypy-lang.org/) in development environments.
* autocompletion support in development editors.

The `item_hash` is commonly used as unique message identifier on Aleph.im.

Cryptographic signatures are out of scope of this library and part of the `aleph-sdk-python`
project, due to their extended scope and dependency on cryptographic libraries.

This library is used in both client and node software of Aleph.im.

## Usage

```shell
pip install aleph-message
```

```python
import requests
from aleph_message import parse_message
from pydantic import ValidationError

ALEPH_API_SERVER = "https://official.aleph.cloud"
MESSAGE_ITEM_HASH = "9b21eb870d01bf64d23e1d4475e342c8f958fcd544adc37db07d8281da070b00"

message_dict = requests.get(ALEPH_API_SERVER + "/api/v0/messages.json?hashes=" + MESSAGE_ITEM_HASH).json()

try:
    message = parse_message(message_dict["messages"][0])
    print(message.sender)
except ValidationError as e:
    print(e.json(indent=4))
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "aleph-message",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Hugo Herter <git@hugoherter.com>",
    "download_url": "https://files.pythonhosted.org/packages/6d/d7/12c78f4c44ac8fd2290ce85b6ec810da0f945e9963bace607fe5a69a0cf2/aleph_message-0.6.1.tar.gz",
    "platform": null,
    "description": "# Aleph.im Message Specification\n\nThis library aims to provide an easy way to create, update and manipulate \nmessages from Aleph.im.\n\nIt mainly consists in [pydantic](https://pydantic-docs.helpmanual.io/) \nmodels that provide field type validation and IDE autocompletion for messages.\n\nThis library provides:\n* schema validation when parsing messages.\n* cryptographic hash validation that the `item_hash` matches the content of the message.\n* type validation using type checkers such as [mypy](https://www.mypy-lang.org/) in development environments.\n* autocompletion support in development editors.\n\nThe `item_hash` is commonly used as unique message identifier on Aleph.im.\n\nCryptographic signatures are out of scope of this library and part of the `aleph-sdk-python`\nproject, due to their extended scope and dependency on cryptographic libraries.\n\nThis library is used in both client and node software of Aleph.im.\n\n## Usage\n\n```shell\npip install aleph-message\n```\n\n```python\nimport requests\nfrom aleph_message import parse_message\nfrom pydantic import ValidationError\n\nALEPH_API_SERVER = \"https://official.aleph.cloud\"\nMESSAGE_ITEM_HASH = \"9b21eb870d01bf64d23e1d4475e342c8f958fcd544adc37db07d8281da070b00\"\n\nmessage_dict = requests.get(ALEPH_API_SERVER + \"/api/v0/messages.json?hashes=\" + MESSAGE_ITEM_HASH).json()\n\ntry:\n    message = parse_message(message_dict[\"messages\"][0])\n    print(message.sender)\nexcept ValidationError as e:\n    print(e.json(indent=4))\n```\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2021 OKESO\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.",
    "summary": "Aleph.im message specification",
    "version": "0.6.1",
    "project_urls": {
        "Documentation": "https://aleph.im/",
        "Homepage": "https://github.com/aleph-im/aleph-message"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d21c036d1e04c924c307f411cc0e66cf87f188a0bb621442e26f06087fee3974",
                "md5": "ddab77dec39995b2258e2ee0b0a2c20f",
                "sha256": "f9986a5786110e880a68be0a60769f3a7ca30718135f152323abcd11e5859ba8"
            },
            "downloads": -1,
            "filename": "aleph_message-0.6.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ddab77dec39995b2258e2ee0b0a2c20f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3",
            "size": 39319,
            "upload_time": "2025-02-18T11:31:18",
            "upload_time_iso_8601": "2025-02-18T11:31:18.451889Z",
            "url": "https://files.pythonhosted.org/packages/d2/1c/036d1e04c924c307f411cc0e66cf87f188a0bb621442e26f06087fee3974/aleph_message-0.6.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6dd712c78f4c44ac8fd2290ce85b6ec810da0f945e9963bace607fe5a69a0cf2",
                "md5": "a316b11ceb91d5103b4c62272debb40a",
                "sha256": "93f013973faa4cf77a5231fb559036e8af5185538a557c138c882487c7597658"
            },
            "downloads": -1,
            "filename": "aleph_message-0.6.1.tar.gz",
            "has_sig": false,
            "md5_digest": "a316b11ceb91d5103b4c62272debb40a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3",
            "size": 22041,
            "upload_time": "2025-02-18T11:31:20",
            "upload_time_iso_8601": "2025-02-18T11:31:20.360327Z",
            "url": "https://files.pythonhosted.org/packages/6d/d7/12c78f4c44ac8fd2290ce85b6ec810da0f945e9963bace607fe5a69a0cf2/aleph_message-0.6.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-18 11:31:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aleph-im",
    "github_project": "aleph-message",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "aleph-message"
}
        
Elapsed time: 1.82009s