codicent-py


Namecodicent-py JSON
Version 1.3.5 PyPI version JSON
download
home_pagehttps://github.com/izaxon/codicent-py
SummaryPython interface to the Codicent API
upload_time2025-07-14 14:38:54
maintainerNone
docs_urlNone
authorJohan
requires_python>=3.7
licenseMIT
keywords codicent api client
VCS
bugtrack_url
requirements requests
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Codicent Python Library
=======================

This library provides a Python interface to the Codicent API.

### Installation
------------
To install using pip, run:
```bash
pip install codicent-py
```

For development installation from source:
```bash
pip install git+https://github.com/izaxon/codicent-py.git
```

To use this library, simply import it into your Python script:
```python
from codicentpy import Codicent
```

### Usage
-----

### Initialization

Create a `Codicent` object with your API token and optional SignalR host:
```python
codicent = Codicent("YOUR_API_TOKEN")
```
### Uploading a file

Upload a file to Codicent:
```python
file_id = codicent.upload(open("example.txt", "rb"))
print(file_id)
```
### Posting a message

Post a message to Codicent:
```python
message_id = codicent.post_message("Hello, world!", type="info")
print(message_id)
```
### Getting messages

Get a list of messages from Codicent:
```python
messages = codicent.get_messages(start=0, length=10)
print(messages)
```

### Get AI chat reply

Sends a message to the Codicent chat (AI) and waits for the reply:
```python
reply = codicent.get_chat_reply("What can you help me with?")
print(reply)
```


Methods
-------

### `__init__`

Initialize the `Codicent` object with a Codicent API token.

### `upload`

Upload a file to Codicent.

* `file`: The file to upload.

Returns the ID of the uploaded file.

### `post_message`

Post a message to Codicent.

* `message`: The message to post.
* `parent_id`: The ID of the parent message (optional).
* `type`: The type of message (default: "info").

Returns the ID of the posted message.

### `get_messages`

Get a list of messages from Codicent.

* `start`: The starting index (default: 0).
* `length`: The number of messages to retrieve (default: 10).
* `search`: A search query (optional).
* `after_timestamp`: A timestamp to retrieve messages after (optional).
* `before_timestamp`: A timestamp to retrieve messages before (optional).

Returns a list of message objects.

### `get_chat_reply`

Sends a message to the Codicent chat (AI) and waits for the reply.

* `message`: The message to send.

### `post_chat_reply`

Posts a message to the Codicent AI chat and returns the reply.

* `message`: The message to send.

Returns a dictionary with:
  - id: The message ID.
  - content: The reply message content.

### Running Tests
To run tests, first install the required dependencies:
```bash
pip install -r requirements.txt
```
Then execute:
```bash
pytest
```

### Building
To build the package, run:
```bash
python setup.py sdist bdist_wheel
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/izaxon/codicent-py",
    "name": "codicent-py",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "codicent, api, client",
    "author": "Johan",
    "author_email": "Johan <johan@example.com>",
    "download_url": "https://files.pythonhosted.org/packages/44/96/f211e7ec31cb686f9709c6173067b5432b5df87ad7846492ac2955bea1a2/codicent_py-1.3.5.tar.gz",
    "platform": null,
    "description": "Codicent Python Library\r\n=======================\r\n\r\nThis library provides a Python interface to the Codicent API.\r\n\r\n### Installation\r\n------------\r\nTo install using pip, run:\r\n```bash\r\npip install codicent-py\r\n```\r\n\r\nFor development installation from source:\r\n```bash\r\npip install git+https://github.com/izaxon/codicent-py.git\r\n```\r\n\r\nTo use this library, simply import it into your Python script:\r\n```python\r\nfrom codicentpy import Codicent\r\n```\r\n\r\n### Usage\r\n-----\r\n\r\n### Initialization\r\n\r\nCreate a `Codicent` object with your API token and optional SignalR host:\r\n```python\r\ncodicent = Codicent(\"YOUR_API_TOKEN\")\r\n```\r\n### Uploading a file\r\n\r\nUpload a file to Codicent:\r\n```python\r\nfile_id = codicent.upload(open(\"example.txt\", \"rb\"))\r\nprint(file_id)\r\n```\r\n### Posting a message\r\n\r\nPost a message to Codicent:\r\n```python\r\nmessage_id = codicent.post_message(\"Hello, world!\", type=\"info\")\r\nprint(message_id)\r\n```\r\n### Getting messages\r\n\r\nGet a list of messages from Codicent:\r\n```python\r\nmessages = codicent.get_messages(start=0, length=10)\r\nprint(messages)\r\n```\r\n\r\n### Get AI chat reply\r\n\r\nSends a message to the Codicent chat (AI) and waits for the reply:\r\n```python\r\nreply = codicent.get_chat_reply(\"What can you help me with?\")\r\nprint(reply)\r\n```\r\n\r\n\r\nMethods\r\n-------\r\n\r\n### `__init__`\r\n\r\nInitialize the `Codicent` object with a Codicent API token.\r\n\r\n### `upload`\r\n\r\nUpload a file to Codicent.\r\n\r\n* `file`: The file to upload.\r\n\r\nReturns the ID of the uploaded file.\r\n\r\n### `post_message`\r\n\r\nPost a message to Codicent.\r\n\r\n* `message`: The message to post.\r\n* `parent_id`: The ID of the parent message (optional).\r\n* `type`: The type of message (default: \"info\").\r\n\r\nReturns the ID of the posted message.\r\n\r\n### `get_messages`\r\n\r\nGet a list of messages from Codicent.\r\n\r\n* `start`: The starting index (default: 0).\r\n* `length`: The number of messages to retrieve (default: 10).\r\n* `search`: A search query (optional).\r\n* `after_timestamp`: A timestamp to retrieve messages after (optional).\r\n* `before_timestamp`: A timestamp to retrieve messages before (optional).\r\n\r\nReturns a list of message objects.\r\n\r\n### `get_chat_reply`\r\n\r\nSends a message to the Codicent chat (AI) and waits for the reply.\r\n\r\n* `message`: The message to send.\r\n\r\n### `post_chat_reply`\r\n\r\nPosts a message to the Codicent AI chat and returns the reply.\r\n\r\n* `message`: The message to send.\r\n\r\nReturns a dictionary with:\r\n  - id: The message ID.\r\n  - content: The reply message content.\r\n\r\n### Running Tests\r\nTo run tests, first install the required dependencies:\r\n```bash\r\npip install -r requirements.txt\r\n```\r\nThen execute:\r\n```bash\r\npytest\r\n```\r\n\r\n### Building\r\nTo build the package, run:\r\n```bash\r\npython setup.py sdist bdist_wheel\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python interface to the Codicent API",
    "version": "1.3.5",
    "project_urls": {
        "Homepage": "https://github.com/izaxon/codicent-py",
        "Issues": "https://github.com/izaxon/codicent-py/issues",
        "Repository": "https://github.com/izaxon/codicent-py"
    },
    "split_keywords": [
        "codicent",
        " api",
        " client"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2f7d9cff41f9b1c95329c460caac1a7ab8381995cc1ce8bb0edb72194c04e9a8",
                "md5": "c87971964cfb3dd29500c48c634b5949",
                "sha256": "f35f16873fe8829a40bea2c3930dc79abb16aa9e34c82033831ee8eb0e5823b2"
            },
            "downloads": -1,
            "filename": "codicent_py-1.3.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c87971964cfb3dd29500c48c634b5949",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 5406,
            "upload_time": "2025-07-14T14:38:50",
            "upload_time_iso_8601": "2025-07-14T14:38:50.859669Z",
            "url": "https://files.pythonhosted.org/packages/2f/7d/9cff41f9b1c95329c460caac1a7ab8381995cc1ce8bb0edb72194c04e9a8/codicent_py-1.3.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4496f211e7ec31cb686f9709c6173067b5432b5df87ad7846492ac2955bea1a2",
                "md5": "7a8cfaa6a4ae1dce8c513f723071f496",
                "sha256": "ebba98dffac8ce19830e78c2cb45e389e02f6e9fae1fc4c900359ba8be7df52c"
            },
            "downloads": -1,
            "filename": "codicent_py-1.3.5.tar.gz",
            "has_sig": false,
            "md5_digest": "7a8cfaa6a4ae1dce8c513f723071f496",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 5276,
            "upload_time": "2025-07-14T14:38:54",
            "upload_time_iso_8601": "2025-07-14T14:38:54.236031Z",
            "url": "https://files.pythonhosted.org/packages/44/96/f211e7ec31cb686f9709c6173067b5432b5df87ad7846492ac2955bea1a2/codicent_py-1.3.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-14 14:38:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "izaxon",
    "github_project": "codicent-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "requests",
            "specs": []
        }
    ],
    "lcname": "codicent-py"
}
        
Elapsed time: 0.42512s