# prefect-hightouch
<p align="center">
<a href="https://pypi.python.org/pypi/prefect-hightouch/" alt="PyPI version">
<img alt="PyPI" src="https://img.shields.io/pypi/v/prefect-hightouch?color=0052FF&labelColor=090422"></a>
<a href="https://github.com/PrefectHQ/prefect-hightouch/" alt="Stars">
<img src="https://img.shields.io/github/stars/PrefectHQ/prefect-hightouch?color=0052FF&labelColor=090422" /></a>
<a href="https://pepy.tech/badge/prefect-hightouch/" alt="Downloads">
<img src="https://img.shields.io/pypi/dm/prefect-hightouch?color=0052FF&labelColor=090422" /></a>
<a href="https://github.com/PrefectHQ/prefect-hightouch/pulse" alt="Activity">
<img src="https://img.shields.io/github/commit-activity/m/PrefectHQ/prefect-hightouch?color=0052FF&labelColor=090422" /></a>
<br>
<a href="https://prefect-community.slack.com" alt="Slack">
<img src="https://img.shields.io/badge/slack-join_community-red.svg?color=0052FF&labelColor=090422&logo=slack" /></a>
<a href="https://discourse.prefect.io/" alt="Discourse">
<img src="https://img.shields.io/badge/discourse-browse_forum-red.svg?color=0052FF&labelColor=090422&logo=discourse" /></a>
</p>
## Welcome!
Prefect integrations for interacting with Hightouch.
## Getting Started
### Python setup
Requires an installation of Python 3.7+.
We recommend using a Python virtual environment manager such as pipenv, conda or virtualenv.
These tasks are designed to work with Prefect 2.0. For more information about how to use Prefect, please refer to the [Prefect documentation](https://orion-docs.prefect.io/).
### Installation
Install `prefect-hightouch` with `pip`:
```bash
pip install prefect-hightouch
```
Then, register to [view the block](https://orion-docs.prefect.io/ui/blocks/) on Prefect Cloud:
```bash
prefect block register -m prefect_hightouch.credentials
```
Note, to use the `load` method on Blocks, you must already have a block document [saved through code](https://orion-docs.prefect.io/concepts/blocks/#saving-blocks) or [saved through the UI](https://orion-docs.prefect.io/ui/blocks/).
### Trigger a sync run and wait for completion
```python
from prefect import flow
from prefect_hightouch import HightouchCredentials
from prefect_hightouch.syncs import trigger_sync_run_and_wait_for_completion
@flow
def sync_flow():
hightouch_credentials = HightouchCredentials.load("hightouch-token")
sync_metadata = trigger_sync_run_and_wait_for_completion(
hightouch_credentials=hightouch_credentials,
sync_id=12345,
full_resync=True,
max_wait_seconds=1800,
poll_frequency_seconds=10,
)
return sync_metadata
sync_flow()
```
### List, get, and trigger syncs
```python
from prefect import flow
from prefect_hightouch import HightouchCredentials, api_models
from prefect_hightouch.syncs import (
list_sync,
get_sync,
list_sync_runs,
trigger_run,
trigger_run_custom,
)
@flow
def hightouch_sync_flow():
hightouch_credentials = HightouchCredentials.load("hightouch-token")
# list all syncs
syncs = list_sync(
hightouch_credentials, order_by=api_models.ListSyncOrderBy.CREATEDAT
)
# get first sync
sync_id = syncs[0].id
sync = get_sync(hightouch_credentials, sync_id)
# list previous runs
sync_runs = list_sync_runs(hightouch_credentials, sync_id)
# trigger by id
sync_run = trigger_run(
hightouch_credentials,
sync_id,
json_body=api_models.TriggerRunInput(full_resync=False),
)
# trigger by slug
sync_slug = syncs[0].slug
sync_run_2 = trigger_run_custom(
hightouch_credentials,
json_body=api_models.TriggerRunCustomInput(
sync_slug=sync_slug,
full_resync=False,
),
)
return sync_runs
hightouch_sync_flow()
```
### Call API endpoints
If an API endpoint is not exposed as a task, you can call the underlying API endpoint functions, but note, these are **not** Prefect tasks.
```python
from prefect_hightouch.credentials import HightouchCredentials
from prefect_hightouch.api_client.api.default import list_destination
credentials = HightouchCredentials.load(token="my-service-token")
client = credentials.get_client()
response = list_destination.sync_detailed(client=client)
data = response.parsed.data
```
## Resources
If you encounter any bugs while using `prefect-hightouch`, feel free to open an issue in the [prefect-hightouch](https://github.com/PrefectHQ/prefect-hightouch) repository.
If you have any questions or issues while using `prefect-hightouch`, you can find help in either the [Prefect Discourse forum](https://discourse.prefect.io/) or the [Prefect Slack community](https://prefect.io/slack).
Feel free to ⭐️ or watch [`prefect-hightouch`](https://github.com/PrefectHQ/prefect-hightouch) for updates too!
## Development
If you'd like to install a version of `prefect-hightouch` for development, clone the repository and perform an editable install with `pip`:
```bash
git clone https://github.com/PrefectHQ/prefect-hightouch.git
cd prefect-hightouch/
pip install -e ".[dev]"
# Install linting pre-commit hooks
pre-commit install
```
Raw data
{
"_id": null,
"home_page": "https://github.com/PrefectHQ/prefect-hightouch",
"name": "prefect-hightouch",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "prefect",
"author": "Prefect Technologies, Inc.",
"author_email": "help@prefect.io",
"download_url": "https://files.pythonhosted.org/packages/5e/16/382328287c771213656e1066f0c9def6ab19a806a8f58c00c65f1591e902/prefect-hightouch-0.2.1.tar.gz",
"platform": null,
"description": "# prefect-hightouch\n\n<p align=\"center\">\n <a href=\"https://pypi.python.org/pypi/prefect-hightouch/\" alt=\"PyPI version\">\n <img alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/prefect-hightouch?color=0052FF&labelColor=090422\"></a>\n <a href=\"https://github.com/PrefectHQ/prefect-hightouch/\" alt=\"Stars\">\n <img src=\"https://img.shields.io/github/stars/PrefectHQ/prefect-hightouch?color=0052FF&labelColor=090422\" /></a>\n <a href=\"https://pepy.tech/badge/prefect-hightouch/\" alt=\"Downloads\">\n <img src=\"https://img.shields.io/pypi/dm/prefect-hightouch?color=0052FF&labelColor=090422\" /></a>\n <a href=\"https://github.com/PrefectHQ/prefect-hightouch/pulse\" alt=\"Activity\">\n <img src=\"https://img.shields.io/github/commit-activity/m/PrefectHQ/prefect-hightouch?color=0052FF&labelColor=090422\" /></a>\n <br>\n <a href=\"https://prefect-community.slack.com\" alt=\"Slack\">\n <img src=\"https://img.shields.io/badge/slack-join_community-red.svg?color=0052FF&labelColor=090422&logo=slack\" /></a>\n <a href=\"https://discourse.prefect.io/\" alt=\"Discourse\">\n <img src=\"https://img.shields.io/badge/discourse-browse_forum-red.svg?color=0052FF&labelColor=090422&logo=discourse\" /></a>\n</p>\n\n## Welcome!\n\nPrefect integrations for interacting with Hightouch.\n\n## Getting Started\n\n### Python setup\n\nRequires an installation of Python 3.7+.\n\nWe recommend using a Python virtual environment manager such as pipenv, conda or virtualenv.\n\nThese tasks are designed to work with Prefect 2.0. For more information about how to use Prefect, please refer to the [Prefect documentation](https://orion-docs.prefect.io/).\n\n### Installation\n\nInstall `prefect-hightouch` with `pip`:\n\n```bash\npip install prefect-hightouch\n```\n\nThen, register to [view the block](https://orion-docs.prefect.io/ui/blocks/) on Prefect Cloud:\n\n```bash\nprefect block register -m prefect_hightouch.credentials\n```\n\nNote, to use the `load` method on Blocks, you must already have a block document [saved through code](https://orion-docs.prefect.io/concepts/blocks/#saving-blocks) or [saved through the UI](https://orion-docs.prefect.io/ui/blocks/).\n\n### Trigger a sync run and wait for completion\n\n```python\nfrom prefect import flow\nfrom prefect_hightouch import HightouchCredentials\nfrom prefect_hightouch.syncs import trigger_sync_run_and_wait_for_completion\n@flow\ndef sync_flow():\n hightouch_credentials = HightouchCredentials.load(\"hightouch-token\")\n sync_metadata = trigger_sync_run_and_wait_for_completion(\n hightouch_credentials=hightouch_credentials,\n sync_id=12345,\n full_resync=True,\n max_wait_seconds=1800,\n poll_frequency_seconds=10,\n )\n return sync_metadata\nsync_flow()\n```\n\n### List, get, and trigger syncs\n\n```python\nfrom prefect import flow\nfrom prefect_hightouch import HightouchCredentials, api_models\nfrom prefect_hightouch.syncs import (\n list_sync,\n get_sync,\n list_sync_runs,\n trigger_run,\n trigger_run_custom,\n)\n\n@flow\ndef hightouch_sync_flow():\n hightouch_credentials = HightouchCredentials.load(\"hightouch-token\")\n\n # list all syncs\n syncs = list_sync(\n hightouch_credentials, order_by=api_models.ListSyncOrderBy.CREATEDAT\n )\n\n # get first sync\n sync_id = syncs[0].id\n sync = get_sync(hightouch_credentials, sync_id)\n\n # list previous runs\n sync_runs = list_sync_runs(hightouch_credentials, sync_id)\n\n # trigger by id\n sync_run = trigger_run(\n hightouch_credentials,\n sync_id,\n json_body=api_models.TriggerRunInput(full_resync=False),\n )\n\n # trigger by slug\n sync_slug = syncs[0].slug\n sync_run_2 = trigger_run_custom(\n hightouch_credentials,\n json_body=api_models.TriggerRunCustomInput(\n sync_slug=sync_slug,\n full_resync=False,\n ),\n )\n return sync_runs\n\nhightouch_sync_flow()\n```\n\n### Call API endpoints\n\nIf an API endpoint is not exposed as a task, you can call the underlying API endpoint functions, but note, these are **not** Prefect tasks.\n\n```python\nfrom prefect_hightouch.credentials import HightouchCredentials\nfrom prefect_hightouch.api_client.api.default import list_destination\n\ncredentials = HightouchCredentials.load(token=\"my-service-token\")\nclient = credentials.get_client()\nresponse = list_destination.sync_detailed(client=client)\ndata = response.parsed.data\n```\n\n## Resources\n\nIf you encounter any bugs while using `prefect-hightouch`, feel free to open an issue in the [prefect-hightouch](https://github.com/PrefectHQ/prefect-hightouch) repository.\n\nIf you have any questions or issues while using `prefect-hightouch`, you can find help in either the [Prefect Discourse forum](https://discourse.prefect.io/) or the [Prefect Slack community](https://prefect.io/slack).\n\nFeel free to \u2b50\ufe0f or watch [`prefect-hightouch`](https://github.com/PrefectHQ/prefect-hightouch) for updates too!\n\n## Development\n\nIf you'd like to install a version of `prefect-hightouch` for development, clone the repository and perform an editable install with `pip`:\n\n```bash\ngit clone https://github.com/PrefectHQ/prefect-hightouch.git\n\ncd prefect-hightouch/\n\npip install -e \".[dev]\"\n\n# Install linting pre-commit hooks\npre-commit install\n```\n",
"bugtrack_url": null,
"license": "Apache License 2.0",
"summary": "Prefect integrations for interacting with Hightouch.",
"version": "0.2.1",
"project_urls": {
"Homepage": "https://github.com/PrefectHQ/prefect-hightouch"
},
"split_keywords": [
"prefect"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "529257f00227e459eda8a9a934b2e617e195b19425c804be1a7619b11bd8ade9",
"md5": "523ee4eafb0bba0a57cb77bf64130898",
"sha256": "e7358af61eaa2934dfd8bc05ee99ae13628473a5b9d2d6425a782a4c54656844"
},
"downloads": -1,
"filename": "prefect_hightouch-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "523ee4eafb0bba0a57cb77bf64130898",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 81629,
"upload_time": "2023-11-13T22:52:06",
"upload_time_iso_8601": "2023-11-13T22:52:06.699306Z",
"url": "https://files.pythonhosted.org/packages/52/92/57f00227e459eda8a9a934b2e617e195b19425c804be1a7619b11bd8ade9/prefect_hightouch-0.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5e16382328287c771213656e1066f0c9def6ab19a806a8f58c00c65f1591e902",
"md5": "942a43da566cf40772b000fd26f05b83",
"sha256": "7bee7e31c49b970591943aa17880a25e506ca94e110382b3e5eb5225d660306c"
},
"downloads": -1,
"filename": "prefect-hightouch-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "942a43da566cf40772b000fd26f05b83",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 53155,
"upload_time": "2023-11-13T22:52:07",
"upload_time_iso_8601": "2023-11-13T22:52:07.929723Z",
"url": "https://files.pythonhosted.org/packages/5e/16/382328287c771213656e1066f0c9def6ab19a806a8f58c00c65f1591e902/prefect-hightouch-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-13 22:52:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "PrefectHQ",
"github_project": "prefect-hightouch",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "prefect-hightouch"
}