{"id":21071260,"url":"https://github.com/yisuschrist/creatio-api-py","last_synced_at":"2025-05-16T05:31:22.720Z","repository":{"id":254744604,"uuid":"847417497","full_name":"YisusChrist/creatio-api-py","owner":"YisusChrist","description":"Python wrapper for working with the Creatio OData API, featuring authentication and CRUD operations on object collections. Ideal for developers working with Creatio environments","archived":false,"fork":false,"pushed_at":"2025-05-12T08:01:48.000Z","size":931,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-12T08:57:16.410Z","etag":null,"topics":["api","api-client","api-rest","creatio","odata","python","python3","rest-api"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/creatio-api-py","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YisusChrist.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-25T19:02:49.000Z","updated_at":"2025-05-12T08:01:51.000Z","dependencies_parsed_at":"2024-10-27T22:16:02.808Z","dependency_job_id":"4bd8b546-80a0-4c87-b34d-1fbe0a7b8e7f","html_url":"https://github.com/YisusChrist/creatio-api-py","commit_stats":null,"previous_names":["yisuschrist/creatio-api-py"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YisusChrist%2Fcreatio-api-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YisusChrist%2Fcreatio-api-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YisusChrist%2Fcreatio-api-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YisusChrist%2Fcreatio-api-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YisusChrist","download_url":"https://codeload.github.com/YisusChrist/creatio-api-py/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254474109,"owners_count":22077216,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-client","api-rest","creatio","odata","python","python3","rest-api"],"created_at":"2024-11-19T18:51:07.423Z","updated_at":"2025-05-16T05:31:17.711Z","avatar_url":"https://github.com/YisusChrist.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Creatio](https://upload.wikimedia.org/wikipedia/commons/thumb/7/76/Creatio_logo.svg/2560px-Creatio_logo.svg.png)\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/YisusChrist/creatio-api-py/issues\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/issues/YisusChrist/creatio-api-py?color=171b20\u0026label=Issues%20%20\u0026logo=gnubash\u0026labelColor=e05f65\u0026logoColor=ffffff\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/YisusChrist/creatio-api-py/forks\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/forks/YisusChrist/creatio-api-py?color=171b20\u0026label=Forks%20%20\u0026logo=git\u0026labelColor=f1cf8a\u0026logoColor=ffffff\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/YisusChrist/creatio-api-py/stargazers\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/stars/YisusChrist/creatio-api-py?color=171b20\u0026label=Stargazers\u0026logo=octicon-star\u0026labelColor=70a5eb\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/YisusChrist/creatio-api-py/actions\"\u003e\n        \u003cimg alt=\"Tests Passing\" src=\"https://github.com/YisusChrist/creatio-api-py/actions/workflows/github-code-scanning/codeql/badge.svg\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/YisusChrist/creatio-api-py/pulls\"\u003e\n        \u003cimg alt=\"GitHub pull requests\" src=\"https://img.shields.io/github/issues-pr/YisusChrist/creatio-api-py?color=0088ff\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\n    \u003c/a\u003e\n    \u003ca href=\"https://opensource.org/license/GPL-3.0/\"\u003e\n        \u003cimg alt=\"License\" src=\"https://img.shields.io/github/license/YisusChrist/creatio-api-py?color=0088ff\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/YisusChrist/creatio-api-py/issues/new/choose\"\u003eReport Bug\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/YisusChrist/creatio-api-py/issues/new/choose\"\u003eRequest Feature\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/YisusChrist/creatio-api-py/discussions\"\u003eAsk Question\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/YisusChrist/creatio-api-py/security/policy#reporting-a-vulnerability\"\u003eReport security bug\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n![Alt](https://repobeats.axiom.co/api/embed/7fb383884a6d110fbd2119f26faed85c7cdc8202.svg \"Repobeats analytics image\")\n\n\u003cbr\u003e\n\nThis Python library is designed for testing the OData API of Creatio. It includes functionality for authentication, making generic HTTP requests to the OData service, and performing various operations on object collections.\n\n\u003cdetails\u003e\n\u003csummary\u003eTable of Contents\u003c/summary\u003e\n\n- [Features](#features)\n- [Requirements](#requirements)\n- [Installation](#installation)\n  - [From PyPI](#from-pypi)\n  - [Manual installation](#manual-installation)\n  - [Uninstall](#uninstall)\n- [Usage](#usage)\n  - [Authentication](#authentication)\n  - [Add a Record to a Collection](#add-a-record-to-a-collection)\n  - [Modify a Record in a Collection](#modify-a-record-in-a-collection)\n  - [Get Data from a Collection](#get-data-from-a-collection)\n  - [Delete a Record from a Collection](#delete-a-record-from-a-collection)\n  - [Handle information from the API session](#handle-information-from-the-api-session)\n- [Contributors](#contributors)\n  - [How do I contribute to creatio-api-py?](#how-do-i-contribute-to-creatio-api-py)\n- [License](#license)\n\n\u003c/details\u003e\n\n# Features\n\n- **Authentication**: Authenticate and obtain a session cookie for subsequent requests.\n- **HTTP Requests**: Make generic HTTP requests (GET, POST, PATCH, DELETE) to the OData service.\n- **Collection Operations**: Interact with object collections, including adding, modifying, and deleting records.\n- **Logging**: Enable debugging to log detailed information about HTTP requests and responses.\n\n# Requirements\n\nHere's a breakdown of the packages needed and their versions:\n\n- [poetry](https://pypi.org/project/poetry) \u003e= 1.7.1 (_only for manual installation_)\n- [python-dotenv](https://pypi.org/project/aiohttp) \u003e= 1.0.1\n- [requests-cache](https://pypi.org/project/requests-cache) \u003e= 1.1.1\n- [requests-pprint](https://pypi.org/project/requests-pprint) \u003e= 1.0.0\n- [requests](https://pypi.org/project/requests) \u003e= 2.31.0\n- [rich](https://pypi.org/project/rich) \u003e= 13.7.0\n\n\u003e [!NOTE]\\\n\u003e The software has been developed and tested using Python `3.12.1`. The minimum required version to run the software is Python 3.6. Although the software may work with previous versions, it is not guaranteed.\n\n# Installation\n\n## From PyPI\n\n`creatio-api-py` can be installed easily as a PyPI package. Just run the following command:\n\n```bash\npip3 install creatio-api-py\n```\n\n\u003e [!IMPORTANT]\n\u003e For best practices and to avoid potential conflicts with your global Python environment, it is strongly recommended to install this program within a virtual environment. Avoid using the --user option for global installations. We highly recommend using [pipx](https://pypi.org/project/pipx) for a safe and isolated installation experience. Therefore, the appropriate command to install `creatio-api-py` would be:\n\u003e\n\u003e ```bash\n\u003e pipx install creatio-api-py\n\u003e ```\n\n## Manual installation\n\nIf you prefer to install the program manually, follow these steps:\n\n\u003e [!NOTE]\\\n\u003e This will install the version from the latest commit, not the latest release.\n\n1. Download the latest version of [creatio-api-py](https://github.com/YisusChrist/creatio-api-py) from this repository:\n\n   ```sh\n   git clone https://github.com/YisusChrist/creatio-api-py\n   cd creatio-api-py\n   ```\n\n2. Install the package:\n\n   ```sh\n   poetry install --only-main\n   ```\n\n## Uninstall\n\nIf you installed it from PyPI, you can use the following command:\n\n```bash\npipx uninstall creatio-api-py\n```\n\n# Usage\n\nThe package allows you to stablish connection to any Creatio environment using the credentials of a user with the necessary permissions. The following steps will guide you through the process of setting up the environment and running the script.\n\n1. Set up your environment variables by creating a .env file with the following content:\n\n   ```env\n   CREATIO_USERNAME=your_username\n   CREATIO_PASSWORD=your_password\n   ```\n\n2. Authenticate to the Creatio environment:\n\n   ```python\n   from creatio_api_py.api import CreatioODataAPI\n   from creatio_api_py.utils import print_exception\n\n   creatio_url: str = \"https://your-environment.creatio.com\"\n   api = CreatioODataAPI(base_url=creatio_url)\n   try:\n      # Authenticate with the API\n      api.authenticate()\n   except Exception as e:\n      print_exception(e, f\"Unable to authenticate on {creatio_url}\")\n   ```\n\n   If you don't want to use the .env file, you can pass the credentials directly to the `authenticate` method:\n\n   ```python\n   api.authenticate(username=\"your_username\", password=\"your_password\")\n   ```\n\n   The `authenticate` method will return an HTTP response object. If the status code is 200, the authentication was successful, and the session cookie is stored in the `api` object. Therefore, your don't need to pass the cookie to the other methods, it will be used automatically for the next requests.\n\n   However, if you want to check the cookie value, you can access it using the `cookie` attribute:\n\n   ```python\n   cookie = api.session_cookies\n   print(cookie)\n   ```\n\n   Response Cookie:\n\n   ```python\n   {\n      'BPMLOADER': 'lima0ugkfcecqs23bdeio1k4',\n      '.ASPXAUTH': '7AE0D4CDCD7DCB01A65ACAF85D8DAC0D842B41745CB17A4AEF4C6F18701757AEA7EAFA90565091E61A54E5559A2B1113C6A6EDA78EFEDECD10176937BBD7F9FEBCAC9210963D42AC059C9858A29F7C903E9CB5FAC3B36CF273B8FF94850CDC01D21F69874990586EEDE392900D87C9D09DF3053D7E5AEDB0D79E0F9172634C9F2566424A5B5F38BD58C2EF1BC06E98ED9168488F7ADE262147E73A3A082CB8CAC74C6A4F6B50555D1ED2A93FC05070E0607B79B32F4ED8B8306918E1F2CCAC1C88CB651DFDF795A36E0A03EFFE0A8AA960BDCD358065C8FDABBF9C59A3FC0B2FEFD77C7E1FC484B6CDAB162F2A5EFB0084FDAA6404AF2773C3DBB8147F83E7040400172E332523BB415AC9432269BF5ED53E2BD70C336CDA513228617AC7A2C9BAD79CBEFE1DE193B1C8E5D6EC836D9F67F4F4033F759CA7E7EDBC433C72441110ECCBD386E05E960822BE049D7BACE51EDFA6B47E57BC654C4B7B3D047AEF9F14F92ACAB37D4286FC9494656B489DE1512DB33869291366E70DA77C9BEDB67706F5896F65B3F835D3C6B4D3367FC7FD086556E1B6F7777FD123848A7038F0AF923758AE398705069FF295D4C0CC180710DC2DE26DD91C09025F0093784241B60757937FEE936A2B80995617DFBB7FE54262F85F7AD4D5465413554A1C67BB0FD21793826C050E8AB83D39747A049C138792E079',\n      'BPMCSRF': 'ezBoM358i3BgxRyW1kKF0u',\n      'UserType': 'General',\n      'UserName': '83|117|112|101|114|118|105|115|111|114'\n   }\n   ```\n\nHere are some examples of how to interact with the Creatio API using this package:\n\n## Authentication\n\n```python\nfrom creatio_api_py.api import CreatioODataAPI\nfrom creatio_api_py.utils import print_exception\n\ncreatio_url: str = \"https://your-environment.creatio.com\"\napi = CreatioODataAPI(base_url=creatio_url)\ntry:\n   # Authenticate with the API\n   api.authenticate()\nexcept Exception as e:  # pylint: disable=broad-except\n   print_exception(e, f\"Unable to authenticate on {creatio_url}\")\n```\n\n## Add a Record to a Collection\n\n```python\npayload: dict[str, str] = {\n   \"UsrEmail\": \"test@test.com\",\n   \"UsrTelefono\": \"123456789\",\n   \"UsrDescripcionBienContratado\": \"Test\",\n   # ... other fields ...\n}\n\nresponse = api.add_collection_data(\"Case\", data=payload)\n```\n\n- Response code: 201 Created\n- Response body:\n\n```python\n{\n   '@odata.context': 'https://your-environment.creatio.com/0/odata/$metadata#Case/$entity',\n   'Id': 'cf8c6558-9e3e-48ca-a237-765b0f54b798',\n   'CreatedOn': '2024-06-17T15:28:32.7013964Z',\n   'CreatedById': '410006e1-ca4e-4502-a9ec-e54d922d2c00',\n   'ModifiedOn': '2024-06-17T15:28:32.7013964Z',\n   'ModifiedById': '410006e1-ca4e-4502-a9ec-e54d922d2c00',\n   'ProcessListeners': 0,\n   'Number': 'SR00005250',\n   'UsrDescripcionBienContratado': 'Test',\n   'UsrEmail': 'test@test.com',\n   'UsrTelefono': '123456789',\n   # ... other fields ...\n}\n```\n\nCreatio returns the created record with the `Id` field. You can use this ID to modify or delete the record later.\n\n## Modify a Record in a Collection\n\n```python\npayload: dict[str, str] = {\n   \"UsrDescripcionBienContratado\": \"New test description\",\n}\n\nrecord_id = \"cf8c6558-9e3e-48ca-a237-765b0f54b798\"\nresponse = api.modify_collection_data(\"Case\", record_id=record_id, data=payload)\n```\n\n- Response code: 204 No Content\n- Response body: None\n\nThe response code 204 indicates that the record has been successfully updated. Creatio does not return a body in this case.\n\n## Get Data from a Collection\n\n```python\nrecord_id = \"cf8c6558-9e3e-48ca-a237-765b0f54b798\"\nresponse = api.get_collection_data(\"Case\", record_id=record_id)\n```\n\n- Response code: 200 OK\n- Response body:\n\n```python\n{\n   '@odata.context': 'https://your-environment.creatio.com/0/odata/$metadata#Case/$entity',\n   'Id': 'cf8c6558-9e3e-48ca-a237-765b0f54b798',\n   'CreatedOn': '2024-06-17T15:28:32.7013964Z',\n   'CreatedById': '410006e1-ca4e-4502-a9ec-e54d922d2c00',\n   'ModifiedOn': '2024-06-17T15:28:32.7013964Z',\n   'ModifiedById': '410006e1-ca4e-4502-a9ec-e54d922d2c00',\n   'ProcessListeners': 0,\n   'Number': 'SR00005250',\n   'UsrDescripcionBienContratado': 'New test description',\n   'UsrEmail': 'test@test.com',\n   'UsrTelefono': '123456789',\n   # ... other fields ...\n}\n```\n\nAs you can see, the field `UsrDescripcionBienContratado` has been updated.\n\n## Delete a Record from a Collection\n\n- Response code: 204 No Content\n- Response body: None\n\n```python\nrecord_id = \"cf8c6558-9e3e-48ca-a237-765b0f54b798\"\nresponse = api.delete_collection_data(\"Case\", record_id=record_id)\n```\n\nThe response code 204 indicates that the record has been successfully deleted. Creatio does not return a body in this case.\n\nIf we try to get the record again, we will get a 404 Not Found response:\n\n```python\nrecord_id = \"cf8c6558-9e3e-48ca-a237-765b0f54b798\"\nresponse = api.get_collection_data(\"Case\", record_id=record_id)\n```\n\n- Response code: 404 Not Found\n- Response body: None\n\n## Handle information from the API session\n\nIt is possible to retrieve information like the total number of requests made, the base url used for the class instance, and the session cookies.\n\n```python\ntotal_requests = api.total_requests\n# 6\nbase_url = api.base_url\n# 'https://your-environment.creatio.com'\nsession_cookies = api.session_cookies\n# {...}\n```\n\nAdditionally, you can modify the object's base url if needed:\n\n```python\napi.base_url = \"https://another-environment.creatio.com\"\n```\n\n# Contributors\n\n\u003ca href=\"https://github.com/YisusChrist/creatio-api-py/graphs/contributors\"\u003e\u003cimg src=\"https://contrib.rocks/image?repo=YisusChrist/creatio-api-py\" /\u003e\u003c/a\u003e\n\n## How do I contribute to creatio-api-py?\n\nBefore you participate in our delightful community, please read the [code of conduct](https://github.com/YisusChrist/.github/blob/main/CODE_OF_CONDUCT.md).\n\nI'm far from being an expert and suspect there are many ways to improve – if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!\n\nWe also need people to test out pull requests. So take a look through [the open issues](https://github.com/YisusChrist/creatio-api-py/issues) and help where you can.\n\nSee [Contributing Guidelines](https://github.com/YisusChrist/.github/blob/main/CONTRIBUTING.md) for more details.\n\n# License\n\n`creatio-api-py` is licensed under the [GNU General Public License v3.0](https://opensource.org/license/GPL-3.0).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyisuschrist%2Fcreatio-api-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyisuschrist%2Fcreatio-api-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyisuschrist%2Fcreatio-api-py/lists"}