From bdf7d5cc113b3e0b9e3a383a670ec44e2c70484c Mon Sep 17 00:00:00 2001 From: Alexander Marquardt Date: Wed, 15 Jun 2022 19:13:50 +0200 Subject: [PATCH 1/2] Update 4-connection-checking.md As discussed in https://airbytehq-team.slack.com/archives/C02UQ9MJ4GG/p1655312684160609 - this example is misleading, as it does not actually connect to any API to validate connectivity. --- .../tutorials/cdk-tutorial-python-http/4-connection-checking.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/connector-development/tutorials/cdk-tutorial-python-http/4-connection-checking.md b/docs/connector-development/tutorials/cdk-tutorial-python-http/4-connection-checking.md index b07f7cc67ce2..7da36d2e0035 100644 --- a/docs/connector-development/tutorials/cdk-tutorial-python-http/4-connection-checking.md +++ b/docs/connector-development/tutorials/cdk-tutorial-python-http/4-connection-checking.md @@ -26,7 +26,7 @@ class SourcePythonHttpTutorial(AbstractSource): ... ``` -Following the docstring instructions, we'll change the implementation to verify that the input currency is a real currency: +Following the docstring instructions, we'll change the implementation to verify that the input currency is a real currency (Note: in a real implementation you should write code to connect to the API to validate connectivity and not just validate inputs): ```python def check_connection(self, logger, config) -> Tuple[bool, any]: From 70a29f068df954606b9f4b069dd50448aea9a8e6 Mon Sep 17 00:00:00 2001 From: Alexander Marquardt Date: Wed, 15 Jun 2022 19:29:50 +0200 Subject: [PATCH 2/2] Update 4-connection-checking.md Added a link to OneSignal check_connection, and move the "Note" to below the example --- .../cdk-tutorial-python-http/4-connection-checking.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/connector-development/tutorials/cdk-tutorial-python-http/4-connection-checking.md b/docs/connector-development/tutorials/cdk-tutorial-python-http/4-connection-checking.md index 7da36d2e0035..16c90f1c6396 100644 --- a/docs/connector-development/tutorials/cdk-tutorial-python-http/4-connection-checking.md +++ b/docs/connector-development/tutorials/cdk-tutorial-python-http/4-connection-checking.md @@ -26,7 +26,7 @@ class SourcePythonHttpTutorial(AbstractSource): ... ``` -Following the docstring instructions, we'll change the implementation to verify that the input currency is a real currency (Note: in a real implementation you should write code to connect to the API to validate connectivity and not just validate inputs): +Following the docstring instructions, we'll change the implementation to verify that the input currency is a real currency: ```python def check_connection(self, logger, config) -> Tuple[bool, any]: @@ -38,6 +38,8 @@ Following the docstring instructions, we'll change the implementation to verify return True, None ``` +Note: in a real implementation you should write code to connect to the API to validate connectivity and not just validate inputs - for an example see `check_connection` in the [OneSignal source connector implementation](https://github.com/airbytehq/airbyte/blob/master/airbyte-integrations/connectors/source-onesignal/source_onesignal/source.py) + Let's test out this implementation by creating two objects: a valid and an invalid config and attempt to give them as input to the connector. For this section, you will need to take the API access key generated earlier and add it to both configs. Because these configs contain secrets, we recommend storing configs which contain secrets in `secrets/config.json` because the `secrets` directory is gitignored by default. ```text