{"id":23413160,"url":"https://github.com/healthitau/pyconnectwise","last_synced_at":"2025-04-05T07:06:17.662Z","repository":{"id":180260354,"uuid":"627402104","full_name":"HealthITAU/pyconnectwise","owner":"HealthITAU","description":"A library for simplifying interactions with the ConnectWise Manage API in Python","archived":false,"fork":false,"pushed_at":"2025-03-31T17:08:43.000Z","size":4824,"stargazers_count":53,"open_issues_count":10,"forks_count":14,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-05T07:06:12.536Z","etag":null,"topics":["annotated","api","automate","client","connectwise","manage","msp","psa","python","typed"],"latest_commit_sha":null,"homepage":"https://healthit.com.au","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/HealthITAU.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}},"created_at":"2023-04-13T11:51:27.000Z","updated_at":"2025-03-18T05:00:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"a6be6a7e-b357-486d-b458-ab7e181bc275","html_url":"https://github.com/HealthITAU/pyconnectwise","commit_stats":null,"previous_names":["healthitau/pyconnectwise"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HealthITAU%2Fpyconnectwise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HealthITAU%2Fpyconnectwise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HealthITAU%2Fpyconnectwise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HealthITAU%2Fpyconnectwise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HealthITAU","download_url":"https://codeload.github.com/HealthITAU/pyconnectwise/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299832,"owners_count":20916190,"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":["annotated","api","automate","client","connectwise","manage","msp","psa","python","typed"],"created_at":"2024-12-22T19:25:39.391Z","updated_at":"2025-04-05T07:06:17.633Z","avatar_url":"https://github.com/HealthITAU.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Health IT Logo](https://healthit.com.au/wp-content/uploads/2019/06/HIT-proper-logo.png)](https://healthit.com.au)\n\n# pyConnectWise - An API library for ConnectWise Manage and ConnectWise Automate, written in Python\n\npyConnectWise is a full-featured, type annotated API client written in Python for the ConnectWise APIs based off their OpenAPI schemas.\n\nThis library has been developed with the intention of making the ConnectWise APIs simple and accessible to non-coders while allowing experienced coders to utilize all features the API has to offer without the boilerplate.\n\npyConnectWise currently supports both ConnectWise Manage and ConnectWise Automate.\n\nFeatures:\n=========\n- **100% API Coverage.** All endpoints and response models have had their code generated from the ConnectWise Manage and ConnectWise Automate OpenAPI schemas.\n- **Non-coder friendly.** 100% annotated for full IDE auto-completion. Clients handle requests and authentication - just plug the right details in and go!\n- **Fully annotated.** This library has a strong focus on type safety and type hinting. Models are declared and parsed using [Pydantic](https://github.com/pydantic/pydantic)\n\npyConnectWise is currently in **pre-release**. This means that while it does work, you may come across issues and inconsistencies.\n\nAs all Endpoint and Model code has been generated, not all of it has been tested. YMMV.\n\nEndpoint generation is custom-built, but Pydantic models have been generated using a customised fork of [datamodel-code-generator](https://github.com/koxudaxi/datamodel-code-generator)\n\nKnown Issues:\n=============\n- Currently only parses **Response** models. No input models yet.\n- As this project is still a WIP, documentation or code commentary may not always align.\n\nRoadmap:\n=============\n- **Automate API Support** - :white_check_mark: Done\n- **Robust error handling** - :white_check_mark: Done\n- **Tests** - :construction: In Progress\n- **Input model validation** - :chart_with_upwards_trend: Planned\n- **ScreenConnect (Control) API Support** - :chart_with_upwards_trend: Planned\n- **Batch requests** - :chart_with_upwards_trend: Planned\n\nHow-to:\n=============\n- [pyConnectWise - An API library for ConnectWise Manage and ConnectWise Automate, written in Python](#pyconnectwise---an-api-library-for-connectwise-manage-and-connectwise-automate-written-in-python)\n- [Features:](#features)\n- [Known Issues:](#known-issues)\n- [Roadmap:](#roadmap)\n- [How-to:](#how-to)\n- [Install](#install)\n- [Initializing the API Clients](#initializing-the-api-clients)\n    - [ConnectWise Manage](#connectwise-manage)\n    - [ConnectWise Automate](#connectwise-automate)\n- [Working with Endpoints](#working-with-endpoints)\n    - [Get many](#get-many)\n    - [Get one](#get-one)\n    - [Get with params](#get-with-params)\n- [Child Endpoints](#child-endpoints)\n        - [Example using ```/company/companies/{company_id}/sites```](#example-using-companycompaniescompany_idsites)\n- [Pagination](#pagination)\n- [Additional Configuration](#additional-configuration)\n    - [Implementation](#implementation)\n    - [Supported Options](#supported-options)\n- [Examples](#examples)\n    - [Get all agreements, then all additions for an agreement](#get-all-agreements-then-all-additions-for-an-agreement)\n    - [Get all service tickets with an ID \\\u003e 1000](#get-all-service-tickets-with-an-id--1000)\n- [Contributing](#contributing)\n  - [Preparing your development environment](#preparing-your-development-environment)\n    - [Quick dependencies install on apt-based systems (using pipx to manage python tools)](#quick-dependencies-install-on-apt-based-systems-using-pipx-to-manage-python-tools)\n    - [Setting up your development environment](#setting-up-your-development-environment)\n  - [Testing](#testing)\n  - [Running code generation](#running-code-generation)\n- [Supporting the project](#supporting-the-project)\n\n# Install\nOpen a terminal and run ```pip install pyconnectwise``` or ```poetry add pyconnectwise```\n\n# Initializing the API Clients\n\n### ConnectWise Manage\n```python\nfrom pyconnectwise import ConnectWiseManageAPIClient\n\n# init client\nmanage_api_client = ConnectWiseManageAPIClient(\n  # your company name,\n  # manage instance url,\n  # your api client id,\n  # your api public key,\n  # your api private key,\n  # optionally, a Config object for customizing API interactions. See [Additional Configuration].\n)\n```\n\n### ConnectWise Automate\n```python\nfrom pyconnectwise import ConnectWiseAutomateAPIClient\n\n# init client\nautomate_api_client = ConnectWiseAutomateAPIClient(\n  # your automate url\n  # your client id\n  # automate api username\n  # automate api password,\n  # optionally, a Config object for customizing API interactions. See [Additional Configuration].\n)\n```\n\n\n# Working with Endpoints\nEndpoints are 1:1 to what's available for both the ConnectWise Manage and ConnectWise Automate as code is generated from their OpenAPI spec.\n\nFor more information, check out the following resources:\n- [ConnectWise Manage REST API Docs (requires ConnectWise Developer account)](https://developer.connectwise.com/Products/ConnectWise_PSA/REST)\n- [ConnectWise Automate REST API Docs (requires ConnectWise Developer account)](https://developer.connectwise.com/Products/ConnectWise_Automate/Integrating_with_Automate/API/REST)\n\n### Get many\n```python\n### Manage ###\n\n# sends GET request to /company/companies endpoint\ncompanies = manage_api_client.company.companies.get()\n\n### Automate ###\n\n# sends GET request to /clients endpoint\nclients = automate_api_client.clients.get()\n```\n\n### Get one\n```python\n### Manage ###\n\n# sends GET request to /company/companies/{id} endpoint\ncompany = manage_api_client.company.companies.id(250).get()\n\n### Automate ###\n\n# sends GET request to /clients/{id} endpoint\nclient = automate_api_client.clients.id(250).get()\n```\n\n### Get with params\n```python\n### Manage ###\n\n# sends GET request to /company/companies with a conditions query string\nconditional_company = manage_api_client.company.companies.get(params={\n  'conditions': 'company/id=250'\n})\n\n### Automate ###\n# sends GET request to /clients endpoint with a condition query string\n# note that the Automate API expects the string 'condition' where-as the Manage API expects the string 'conditions'\nconditional_client = automate_api_client.clients.get(params={\n  'condition': 'company/id=250'\n})\n```\n\n# Child Endpoints\nThe ConnectWise APIs have many instances of endpoints with path parameters - for example, ```/company/companies/{company_id}/sites```\n\nThis also exists in the library. Endpoints provide an ```id``` method for setting the ID and traversing down the path.\n\n##### Example using ```/company/companies/{company_id}/sites```\n```python\n# equivalent to GET /company/companies/250/sites\nsites = manage_api_client.company.companies.id(250).sites.get()\n```\n\n# Pagination\nThe ConnectWise Manage API paginates data for performance reasons through the ```page``` and ```pageSize``` query parameters. ```pageSize``` is limited to a maximum of 1000.\n\nTo make working with paginated data easy, Endpoints that implement a GET response with an array also supply a ```paginated()``` method. Under the hood this wraps a GET request, but does a lot of neat stuff to make working with pages easier.\n\nWorking with pagination\n```python\n# initialize a PaginatedResponse instance for /company/companies, starting on page 1 with a pageSize of 100\npaginated_companies = manage_api_client.company.companies.paginated(1,100)\n\n# access the data from the current page using the .data field\npage_one_data = paginated_companies.data\n\n# if there's a next page, retrieve the next page worth of data\npaginated_companies.get_next_page()\n\n# if there's a previous page, retrieve the previous page worth of data\npaginated_companies.get_previous_page()\n\n# iterate over all companies on the current page\nfor company in paginated_companies:\n  # ... do things ...\n\n# iterate over all companies in all pages\n# this works by yielding every item on the page, then fetching the next page and continuing until there's no data left\nfor company in paginated_companies.all():\n  # ... do things ...\n```\n\n# Additional Configuration\nAs of version ```0.4.6```, pyConnectWise clients now accept a new ```Config``` object for additional API interaction configuration.\n\n### Implementation\n\n```python\nfrom pyconnectwise import ConnectWiseManageAPIClient, ConnectWiseAutomateAPIClient\nfrom pyconnectwise.config import Config\n\n# create an instance of Config with your own changes...\nconfig = Config(max_retries = 5)\n\n# ... and hand off to the clients during initialization\nmanage_api_client = ConnectWiseManageAPIClient(config = config)\nautomate_api_client = ConnectWiseAutomateAPIClient(config = config)\n```\n\n### Supported Options\nAs of version ```0.4.6```, the following Config options are supported:\n* ```max_retries``` - The number of times to re-attempt a request if a HTTP 500 error occurs. Defaults to 3.\n\n# Examples\n\n### Get all agreements, then all additions for an agreement\n```python\nagreements = api.finance.agreements.paginated(1, 1000)\nfor agreement in agreements.all():\n    additions = api.finance.agreements.id(agreement.id).additions.get()\n```\n\n### Get all service tickets with an ID \u003e 1000\n```python\ntickets = api.service.tickets.get(params={\n    'conditions': 'id \u003e 1000'\n})\n```\n\n# Contributing\nContributions to the project are welcome. If you find any issues or have suggestions for improvement, please feel free to open an issue or submit a pull request.\n\nWhen working on the project, please note that there's a few requirements you'll need to install in order to run the project locally. These requirements are stored in [requirements.txt](requirements.txt)\n\nYou can install these requirements by opening a terminal, navigating to the repo's directory and running ```pip install -r requirements.txt```\n\n## Preparing your development environment\nPrerequisites:\n- Python 3.10+\n- [Poetry](https://python-poetry.org/docs/#installing-with-pipx)\n- [Pre-Commit](https://pre-commit.com/#install)\n\n### Quick dependencies install on apt-based systems (using pipx to manage python tools)\n```bash\nsudo apt install pipx\npipx install poetry\npipx install pre-commit\n```\n### Setting up your development environment\n```bash\npoetry install --with=dev\npre-commit install\n```\n\n## Testing\n```bash\npoetry run pytest\n```\n\n## Running code generation\n```bash\npoetry run python -m pyconnectwise_generator \u003cpath to schema file\u003e\n```\n\n# Supporting the project\n:heart: the project and would like to show your support? Please consider donating to the following charities:\n- [Black Dog](https://donate.blackdoginstitute.org.au/)\n- [Cure4 CysticFibrosis Foundation](https://app.etapestry.com/onlineforms/Cure4CFFoundation/Donatenow.html)\n- [Vinnies CEO Sleepout](https://www.ceosleepout.org.au/donation)\n- [Care.org.au's Ukraine Humanitarian Crisis fund](https://www.care.org.au/appeals/ukraine-humanitarian-crisis/)\n- [RedFrogs Australia](https://redfrogs.com.au/support/donate)\n- [Love Your Sister (Sam's 1000)](https://www.loveyoursister.org/makeadonation)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhealthitau%2Fpyconnectwise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhealthitau%2Fpyconnectwise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhealthitau%2Fpyconnectwise/lists"}