From 07d854f5647a46943fdbe38b434f0c533fa894fa Mon Sep 17 00:00:00 2001 From: Davin Chia Date: Mon, 16 Aug 2021 12:27:53 +0800 Subject: [PATCH] Set up Shortio integration test and release connector. (#5418) --- .github/workflows/publish-command.yml | 15 +- .github/workflows/test-command.yml | 15 +- .../source-hubspot/source_hubspot/api.py | 2 +- .../source-shortio/acceptance-test-config.yml | 8 +- .../integration_tests/abnormal_state.json | 2 +- .../integration_tests/configured_catalog.json | 488 +++++++++--------- .../integration_tests/invalid_config.json | 2 +- .../integration_tests/state.json | 2 +- .../source_shortio/schemas/links.json | 280 +++++----- .../source-shortio/source_shortio/source.py | 20 +- tools/bin/ci_credentials.sh | 1 + 11 files changed, 408 insertions(+), 427 deletions(-) diff --git a/.github/workflows/publish-command.yml b/.github/workflows/publish-command.yml index 65625154018ec..ecdfb64759664 100644 --- a/.github/workflows/publish-command.yml +++ b/.github/workflows/publish-command.yml @@ -3,14 +3,14 @@ on: workflow_dispatch: inputs: connector: - description: 'Airbyte Connector' + description: "Airbyte Connector" required: true run-tests: - description: 'Should run tests when publishing' + description: "Should run tests when publishing" required: true - default: 'true' + default: "true" comment-id: - description: 'The comment-id of the slash command. Used to update the comment with the status.' + description: "The comment-id of the slash command. Used to update the comment with the status." required: false jobs: @@ -48,8 +48,8 @@ jobs: id: regex uses: AsasInnab/regex-action@v1 with: - regex_pattern: '^(connectors|bases)/[a-zA-Z0-9-_]+$' - regex_flags: 'i' # required to be set for this plugin + regex_pattern: "^(connectors|bases)/[a-zA-Z0-9-_]+$" + regex_flags: "i" # required to be set for this plugin search_string: ${{ github.event.inputs.connector }} - name: Validate input workflow format if: steps.regex.outputs.first_match != github.event.inputs.connector @@ -136,6 +136,7 @@ jobs: SOURCE_MARKETO_SINGER_INTEGRATION_TEST_CONFIG: ${{ secrets.SOURCE_MARKETO_SINGER_INTEGRATION_TEST_CONFIG }} SOURCE_RECURLY_INTEGRATION_TEST_CREDS: ${{ secrets.SOURCE_RECURLY_INTEGRATION_TEST_CREDS }} SOURCE_S3_TEST_CREDS: ${{ secrets.SOURCE_S3_TEST_CREDS }} + SOURCE_SHORTIO_TEST_CREDS: ${{ secrets.SOURCE_SHORTIO_TEST_CREDS }} SOURCE_STRIPE_CREDS: ${{ secrets.SOURCE_STRIPE_CREDS }} STRIPE_INTEGRATION_CONNECTED_ACCOUNT_TEST_CREDS: ${{ secrets.STRIPE_INTEGRATION_CONNECTED_ACCOUNT_TEST_CREDS }} SURVEYMONKEY_TEST_CREDS: ${{ secrets.SURVEYMONKEY_TEST_CREDS }} @@ -183,7 +184,7 @@ jobs: SLACK_USERNAME: Buildozer SLACK_ICON: https://avatars.slack-edge.com/temp/2020-09-01/1342729352468_209b10acd6ff13a649a1.jpg SLACK_COLOR: DC143C - SLACK_TITLE: 'Failed to publish connector ${{ github.event.inputs.connector }} from branch ${{ github.ref }}' + SLACK_TITLE: "Failed to publish connector ${{ github.event.inputs.connector }} from branch ${{ github.ref }}" SLACK_FOOTER: "" # In case of self-hosted EC2 errors, remove this block. stop-publish-image-runner: diff --git a/.github/workflows/test-command.yml b/.github/workflows/test-command.yml index 972a7918cd9ed..9a70d0f07474a 100644 --- a/.github/workflows/test-command.yml +++ b/.github/workflows/test-command.yml @@ -3,14 +3,14 @@ on: workflow_dispatch: inputs: connector: - description: 'Airbyte Connector' + description: "Airbyte Connector" required: true repo: - description: 'Repo to check out code from. Defaults to the main airbyte repo. Set this when building connectors from forked repos.' + description: "Repo to check out code from. Defaults to the main airbyte repo. Set this when building connectors from forked repos." required: false - default: 'airbytehq/airbyte' + default: "airbytehq/airbyte" comment-id: - description: 'The comment-id of the slash command. Used to update the comment with the status.' + description: "The comment-id of the slash command. Used to update the comment with the status." required: false jobs: @@ -48,8 +48,8 @@ jobs: id: regex uses: AsasInnab/regex-action@v1 with: - regex_pattern: '^((connectors|bases)/)?[a-zA-Z0-9-_]+$' - regex_flags: 'i' # required to be set for this plugin + regex_pattern: "^((connectors|bases)/)?[a-zA-Z0-9-_]+$" + regex_flags: "i" # required to be set for this plugin search_string: ${{ github.event.inputs.connector }} - name: Validate input workflow format if: steps.regex.outputs.first_match != github.event.inputs.connector @@ -136,6 +136,7 @@ jobs: SOURCE_MARKETO_SINGER_INTEGRATION_TEST_CONFIG: ${{ secrets.SOURCE_MARKETO_SINGER_INTEGRATION_TEST_CONFIG }} SOURCE_RECURLY_INTEGRATION_TEST_CREDS: ${{ secrets.SOURCE_RECURLY_INTEGRATION_TEST_CREDS }} SOURCE_S3_TEST_CREDS: ${{ secrets.SOURCE_S3_TEST_CREDS }} + SOURCE_SHORTIO_TEST_CREDS: ${{ secrets.SOURCE_SHORTIO_TEST_CREDS }} SOURCE_STRIPE_CREDS: ${{ secrets.SOURCE_STRIPE_CREDS }} STRIPE_INTEGRATION_CONNECTED_ACCOUNT_TEST_CREDS: ${{ secrets.STRIPE_INTEGRATION_CONNECTED_ACCOUNT_TEST_CREDS }} SURVEYMONKEY_TEST_CREDS: ${{ secrets.SURVEYMONKEY_TEST_CREDS }} @@ -178,7 +179,7 @@ jobs: env: AWS_ACCESS_KEY_ID: ${{ secrets.STATUS_API_AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.STATUS_API_AWS_SECRET_ACCESS_KEY }} - AWS_DEFAULT_REGION: 'us-east-2' + AWS_DEFAULT_REGION: "us-east-2" - name: Add Success Comment if: github.event.inputs.comment-id && success() uses: peter-evans/create-or-update-comment@v1 diff --git a/airbyte-integrations/connectors/source-hubspot/source_hubspot/api.py b/airbyte-integrations/connectors/source-hubspot/source_hubspot/api.py index f3060d718a009..09d6193e76a9c 100644 --- a/airbyte-integrations/connectors/source-hubspot/source_hubspot/api.py +++ b/airbyte-integrations/connectors/source-hubspot/source_hubspot/api.py @@ -276,7 +276,7 @@ def _cast_value(declared_field_types: List, field_name: str, field_value): # do not cast numeric IDs into float, use integer instead target_type = int if field_name.endswith("_id") else target_type - if target_type_name != "string" and field_value == '': + if target_type_name != "string" and field_value == "": # do not cast empty strings, return None instead to be properly casted. field_value = None return field_value diff --git a/airbyte-integrations/connectors/source-shortio/acceptance-test-config.yml b/airbyte-integrations/connectors/source-shortio/acceptance-test-config.yml index 652a56c55bd17..1ed10b5759752 100644 --- a/airbyte-integrations/connectors/source-shortio/acceptance-test-config.yml +++ b/airbyte-integrations/connectors/source-shortio/acceptance-test-config.yml @@ -15,13 +15,7 @@ tests: - config_path: "secrets/config.json" configured_catalog_path: "integration_tests/configured_catalog.json" empty_streams: [] -# TODO uncomment this block to specify that the tests should assert the connector outputs the records provided in the input file a file -# expect_records: -# path: "integration_tests/expected_records.txt" -# extra_fields: no -# exact_order: no -# extra_records: yes - incremental: # TODO if your connector does not implement incremental sync, remove this block + incremental: - config_path: "secrets/config.json" configured_catalog_path: "integration_tests/configured_catalog.json" future_state_path: "integration_tests/abnormal_state.json" diff --git a/airbyte-integrations/connectors/source-shortio/integration_tests/abnormal_state.json b/airbyte-integrations/connectors/source-shortio/integration_tests/abnormal_state.json index 3662dbce97d47..b57ea413e8477 100644 --- a/airbyte-integrations/connectors/source-shortio/integration_tests/abnormal_state.json +++ b/airbyte-integrations/connectors/source-shortio/integration_tests/abnormal_state.json @@ -1,5 +1,5 @@ { "clicks": { - "dt" : "2022-07-17 14:03:43.449925" + "dt": "2022-07-17 14:03:43.449925" } } diff --git a/airbyte-integrations/connectors/source-shortio/integration_tests/configured_catalog.json b/airbyte-integrations/connectors/source-shortio/integration_tests/configured_catalog.json index 8f5e79cae239c..1d403515b60d8 100644 --- a/airbyte-integrations/connectors/source-shortio/integration_tests/configured_catalog.json +++ b/airbyte-integrations/connectors/source-shortio/integration_tests/configured_catalog.json @@ -1,255 +1,249 @@ { "streams": [ - { - "destination_sync_mode": "append", - "sync_mode": "incremental", - "stream": { - "name": "clicks", - "source_defined_cursor": true, - "default_cursor_field": [ - "dt" - ], - "supported_sync_modes": [ - "incremental" - ], - "json_schema": { - "properties": { - "host": { - "type": ["null","string"] - }, - "path": { - "type": ["null","string"] - }, - "method": { - "type": ["null","string"] - }, - "url": { - "type": ["null","string"] - }, - "dt": { - "type": ["null","string"], - "format": "date-time" - }, - "st": { - "type": ["null","integer"] - }, - "ip": { - "type": ["null","string"] - }, - "proto": { - "type": ["null","string"] - }, - "ref": { - "type": ["null","string"] - }, - "ua": { - "type": ["null","string"] - }, - "human": { - "type": ["null","boolean"] - }, - "browser": { - "type": ["null","string"] - }, - "browser_version": { - "type": ["null","string"] - }, - "country": { - "type": ["null","string"] - }, - "city": { - "type": ["null","string"] - }, - "social": { - "type": ["null","string"] - }, - "refhost": { - "type": ["null","string"] - }, - "os": { - "type": ["null","string"] - }, - "utm_source": { - "type": ["null","string"] - }, - "utm_medium": { - "type": ["null","string"] - }, - "utm_campaign": { - "type": ["null","string"] - }, - "goal_completed": { - "type": ["null","string"] - }, - "ab_path": { - "type": ["null","string"] - }, - "lcpath": { - "type": ["null","string"] - } - } - } + { + "destination_sync_mode": "append", + "sync_mode": "incremental", + "stream": { + "name": "clicks", + "source_defined_cursor": true, + "default_cursor_field": ["dt"], + "supported_sync_modes": ["incremental"], + "json_schema": { + "properties": { + "host": { + "type": ["null", "string"] + }, + "path": { + "type": ["null", "string"] + }, + "method": { + "type": ["null", "string"] + }, + "url": { + "type": ["null", "string"] + }, + "dt": { + "type": ["null", "string"], + "format": "date-time" + }, + "st": { + "type": ["null", "integer"] + }, + "ip": { + "type": ["null", "string"] + }, + "proto": { + "type": ["null", "string"] + }, + "ref": { + "type": ["null", "string"] + }, + "ua": { + "type": ["null", "string"] + }, + "human": { + "type": ["null", "boolean"] + }, + "browser": { + "type": ["null", "string"] + }, + "browser_version": { + "type": ["null", "string"] + }, + "country": { + "type": ["null", "string"] + }, + "city": { + "type": ["null", "string"] + }, + "social": { + "type": ["null", "string"] + }, + "refhost": { + "type": ["null", "string"] + }, + "os": { + "type": ["null", "string"] + }, + "utm_source": { + "type": ["null", "string"] + }, + "utm_medium": { + "type": ["null", "string"] + }, + "utm_campaign": { + "type": ["null", "string"] + }, + "goal_completed": { + "type": ["null", "string"] + }, + "ab_path": { + "type": ["null", "string"] + }, + "lcpath": { + "type": ["null", "string"] + } } - }, - { - "destination_sync_mode": "append", - "sync_mode": "full_refresh", - "stream": { - "name": "links", - "source_defined_cursor": true, - "supported_sync_modes": [ - "full_refresh" - ], - "json_schema": { - "properties": { - "id": { - "type": "integer" - }, - "path": { - "type": ["null","string"] - }, - "title": { - "type": ["null","string"] - }, - "icon": { - "type": ["null","string"] - }, - "archived": { - "type": ["null","boolean"] - }, - "originalURL": { - "type": "string" - }, - "iphoneURL": { - "type": ["null","string"] - }, - "androidURL": { - "type": ["null","string"] - }, - "password" : { - "type" : ["null","string"] - }, - "utmSource" : { - "type" : ["null","string"] - }, - "utmMedium" : { - "type" : ["null","string"] - }, - "utmCampaign" : { - "type" : ["null","string"] - }, - "utmCampaignId" : { - "type" :["null","string"] - }, - "utmTerm" : { - "type" : ["null","string"] - }, - "utmContent" : { - "type" :["null","string"] - }, - "splitURL": { - "type": ["null","string"] - }, - "splitPercent": { - "type": ["null","string"] - }, - "expiresAt": { - "type": ["null","string"] - }, - "expiredURL": { - "type": ["null","string"] - }, - "redirectType": { - "type": ["null","string"] - }, - "clicksLimit": { - "type": ["null","string"] - }, - "cloaking": { - "type": ["null","boolean"] - }, - "source": { - "type": ["null","string"] - }, - "integrationGA": { - "type": ["null","string"] - }, - "integrationFB": { - "type": ["null","string"] - }, - "integrationAdroll": { - "type": ["null","string"] - }, - "integrationGTM": { - "type": ["null","string"] - }, - "AutodeletedAt": { - "type": ["null","string"], - "format": "date-time" - }, - "createdAt": { - "type": "string", - "format": "date-time" - }, - "updatedAt": { - "type": "string", - "format": "date-time" - }, - "DomainId": { - "type": "integer" - }, - "Owner": { - "type": ["null","object"], - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": ["null","string"] - }, - "email": { - "type": ["null","string"] - }, - "photoURL": { - "type": ["null","string"] - } - } - }, - "tags": { - "type": ["null", "array"], - "items": { - "type": "string" - } - }, - "secureShortURL": { - "type": ["null","string"] - }, - "idString": { - "type": "string" - }, - "shortURL": { - "type": "string" - }, - "User": { - "type": ["null","object"], - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": ["null","string"] - }, - "email": { - "type": ["null","string"] - }, - "photoURL": { - "type": ["null","string"] - } - } - } - } + } + } + }, + { + "destination_sync_mode": "append", + "sync_mode": "full_refresh", + "stream": { + "name": "links", + "source_defined_cursor": true, + "supported_sync_modes": ["full_refresh"], + "json_schema": { + "properties": { + "id": { + "type": "integer" + }, + "path": { + "type": ["null", "string"] + }, + "title": { + "type": ["null", "string"] + }, + "icon": { + "type": ["null", "string"] + }, + "archived": { + "type": ["null", "boolean"] + }, + "originalURL": { + "type": "string" + }, + "iphoneURL": { + "type": ["null", "string"] + }, + "androidURL": { + "type": ["null", "string"] + }, + "password": { + "type": ["null", "string"] + }, + "utmSource": { + "type": ["null", "string"] + }, + "utmMedium": { + "type": ["null", "string"] + }, + "utmCampaign": { + "type": ["null", "string"] + }, + "utmCampaignId": { + "type": ["null", "string"] + }, + "utmTerm": { + "type": ["null", "string"] + }, + "utmContent": { + "type": ["null", "string"] + }, + "splitURL": { + "type": ["null", "string"] + }, + "splitPercent": { + "type": ["null", "string"] + }, + "expiresAt": { + "type": ["null", "string"] + }, + "expiredURL": { + "type": ["null", "string"] + }, + "redirectType": { + "type": ["null", "string"] + }, + "clicksLimit": { + "type": ["null", "string"] + }, + "cloaking": { + "type": ["null", "boolean"] + }, + "source": { + "type": ["null", "string"] + }, + "integrationGA": { + "type": ["null", "string"] + }, + "integrationFB": { + "type": ["null", "string"] + }, + "integrationAdroll": { + "type": ["null", "string"] + }, + "integrationGTM": { + "type": ["null", "string"] + }, + "AutodeletedAt": { + "type": ["null", "string"], + "format": "date-time" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "DomainId": { + "type": "integer" + }, + "Owner": { + "type": ["null", "object"], + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": ["null", "string"] + }, + "email": { + "type": ["null", "string"] + }, + "photoURL": { + "type": ["null", "string"] + } + } + }, + "tags": { + "type": ["null", "array"], + "items": { + "type": "string" + } + }, + "secureShortURL": { + "type": ["null", "string"] + }, + "idString": { + "type": "string" + }, + "shortURL": { + "type": "string" + }, + "User": { + "type": ["null", "object"], + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": ["null", "string"] + }, + "email": { + "type": ["null", "string"] + }, + "photoURL": { + "type": ["null", "string"] + } } + } } + } } + } ] } diff --git a/airbyte-integrations/connectors/source-shortio/integration_tests/invalid_config.json b/airbyte-integrations/connectors/source-shortio/integration_tests/invalid_config.json index f56143dc2a075..2017a4d76fa9f 100644 --- a/airbyte-integrations/connectors/source-shortio/integration_tests/invalid_config.json +++ b/airbyte-integrations/connectors/source-shortio/integration_tests/invalid_config.json @@ -1,5 +1,5 @@ { "secret_key": "RANDOMKEY", "domain_id": "123456", - "start_date" : "2021-07-01" + "start_date": "2021-07-01" } diff --git a/airbyte-integrations/connectors/source-shortio/integration_tests/state.json b/airbyte-integrations/connectors/source-shortio/integration_tests/state.json index 85656bf0160bb..85ee259630dfd 100644 --- a/airbyte-integrations/connectors/source-shortio/integration_tests/state.json +++ b/airbyte-integrations/connectors/source-shortio/integration_tests/state.json @@ -1,5 +1,5 @@ { "clicks": { - "dt" : "2021-07-28 14:03:43.449925" + "dt": "2021-07-28 14:03:43.449925" } } diff --git a/airbyte-integrations/connectors/source-shortio/source_shortio/schemas/links.json b/airbyte-integrations/connectors/source-shortio/source_shortio/schemas/links.json index f0e6a9b0d0c44..6a55f8eb929d9 100644 --- a/airbyte-integrations/connectors/source-shortio/source_shortio/schemas/links.json +++ b/airbyte-integrations/connectors/source-shortio/source_shortio/schemas/links.json @@ -1,151 +1,151 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "properties": { + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "path": { + "type": ["null", "string"] + }, + "title": { + "type": ["null", "string"] + }, + "icon": { + "type": ["null", "string"] + }, + "archived": { + "type": ["null", "boolean"] + }, + "originalURL": { + "type": "string" + }, + "iphoneURL": { + "type": ["null", "string"] + }, + "androidURL": { + "type": ["null", "string"] + }, + "password": { + "type": ["null", "string"] + }, + "utmSource": { + "type": ["null", "string"] + }, + "utmMedium": { + "type": ["null", "string"] + }, + "utmCampaign": { + "type": ["null", "string"] + }, + "utmCampaignId": { + "type": ["null", "string"] + }, + "utmTerm": { + "type": ["null", "string"] + }, + "utmContent": { + "type": ["null", "string"] + }, + "splitURL": { + "type": ["null", "string"] + }, + "splitPercent": { + "type": ["null", "string"] + }, + "expiresAt": { + "type": ["null", "string"] + }, + "expiredURL": { + "type": ["null", "string"] + }, + "redirectType": { + "type": ["null", "string"] + }, + "clicksLimit": { + "type": ["null", "string"] + }, + "cloaking": { + "type": ["null", "boolean"] + }, + "source": { + "type": ["null", "string"] + }, + "integrationGA": { + "type": ["null", "string"] + }, + "integrationFB": { + "type": ["null", "string"] + }, + "integrationAdroll": { + "type": ["null", "string"] + }, + "integrationGTM": { + "type": ["null", "string"] + }, + "AutodeletedAt": { + "type": ["null", "string"], + "format": "date-time" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "DomainId": { + "type": "integer" + }, + "Owner": { + "type": ["null", "object"], + "properties": { "id": { - "type": "integer" + "type": "integer" }, - "path": { - "type": ["null","string"] + "name": { + "type": ["null", "string"] }, - "title": { - "type": ["null","string"] + "email": { + "type": ["null", "string"] }, - "icon": { - "type": ["null","string"] - }, - "archived": { - "type": ["null","boolean"] - }, - "originalURL": { - "type": "string" - }, - "iphoneURL": { - "type": ["null","string"] - }, - "androidURL": { - "type": ["null","string"] - }, - "password" : { - "type" : ["null","string"] - }, - "utmSource" : { - "type" : ["null","string"] - }, - "utmMedium" : { - "type" : ["null","string"] - }, - "utmCampaign" : { - "type" : ["null","string"] - }, - "utmCampaignId" : { - "type" :["null","string"] - }, - "utmTerm" : { - "type" : ["null","string"] - }, - "utmContent" : { - "type" :["null","string"] - }, - "splitURL": { - "type": ["null","string"] - }, - "splitPercent": { - "type": ["null","string"] - }, - "expiresAt": { - "type": ["null","string"] - }, - "expiredURL": { - "type": ["null","string"] - }, - "redirectType": { - "type": ["null","string"] - }, - "clicksLimit": { - "type": ["null","string"] - }, - "cloaking": { - "type": ["null","boolean"] - }, - "source": { - "type": ["null","string"] - }, - "integrationGA": { - "type": ["null","string"] - }, - "integrationFB": { - "type": ["null","string"] - }, - "integrationAdroll": { - "type": ["null","string"] - }, - "integrationGTM": { - "type": ["null","string"] - }, - "AutodeletedAt": { - "type": ["null","string"], - "format": "date-time" - }, - "createdAt": { - "type": "string", - "format": "date-time" - }, - "updatedAt": { - "type": "string", - "format": "date-time" - }, - "DomainId": { - "type": "integer" - }, - "Owner": { - "type": ["null","object"], - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": ["null","string"] - }, - "email": { - "type": ["null","string"] - }, - "photoURL": { - "type": ["null","string"] - } - } - }, - "tags": { - "type": ["null", "array"], - "items": { - "type": "string" - } - }, - "secureShortURL": { - "type": ["null","string"] + "photoURL": { + "type": ["null", "string"] + } + } + }, + "tags": { + "type": ["null", "array"], + "items": { + "type": "string" + } + }, + "secureShortURL": { + "type": ["null", "string"] + }, + "idString": { + "type": "string" + }, + "shortURL": { + "type": "string" + }, + "User": { + "type": ["null", "object"], + "properties": { + "id": { + "type": "integer" }, - "idString": { - "type": "string" + "name": { + "type": ["null", "string"] }, - "shortURL": { - "type": "string" + "email": { + "type": ["null", "string"] }, - "User": { - "type": ["null","object"], - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": ["null","string"] - }, - "email": { - "type": ["null","string"] - }, - "photoURL": { - "type": ["null","string"] - } - } + "photoURL": { + "type": ["null", "string"] } + } } + } } diff --git a/airbyte-integrations/connectors/source-shortio/source_shortio/source.py b/airbyte-integrations/connectors/source-shortio/source_shortio/source.py index 99e5a8873a2ba..c8696e4b180ca 100644 --- a/airbyte-integrations/connectors/source-shortio/source_shortio/source.py +++ b/airbyte-integrations/connectors/source-shortio/source_shortio/source.py @@ -48,15 +48,11 @@ class Links(HttpStream, ABC): before_id = None domain_id = None - def next_page_token( - self, response: requests.Response - ) -> Optional[Mapping[str, Any]]: + def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, Any]]: links = json.loads(response.text)["links"] try: - earliest_id_string = sorted( - links, key=lambda k: k["createdAt"], reverse=False - )[0]["idString"] + earliest_id_string = sorted(links, key=lambda k: k["createdAt"], reverse=False)[0]["idString"] if self.before_id != earliest_id_string: self.before_id = earliest_id_string return earliest_id_string @@ -86,9 +82,7 @@ def path( # Get all the links return "/links" - def parse_response( - self, response: requests.Response, **kwargs - ) -> Iterable[Mapping]: + def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapping]: """ The short.io API can be inconsistent in its inclusion of UTM parameters. Here, we check if they've been provided and if they haven't, attempt to extract it from the original url. @@ -160,9 +154,7 @@ def path( # Get all the links return f"{self.domain_id}/last_clicks" - def next_page_token( - self, response: requests.Response - ) -> Optional[Mapping[str, Any]]: + def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, Any]]: """ This function goes through the API responses and ensures that no more requests are left to take place :return str: min(dt) object from the previous API response. @@ -222,9 +214,7 @@ def request_body_json( return payload - def parse_response( - self, response: requests.Response, **kwargs - ) -> Iterable[Mapping]: + def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapping]: yield from json.loads(response.text) diff --git a/tools/bin/ci_credentials.sh b/tools/bin/ci_credentials.sh index 1be3bb43ac375..50c4bcf34c072 100755 --- a/tools/bin/ci_credentials.sh +++ b/tools/bin/ci_credentials.sh @@ -91,6 +91,7 @@ write_standard_creds source-s3 "$SOURCE_S3_TEST_CREDS" write_standard_creds source-salesforce-singer "$SALESFORCE_INTEGRATION_TESTS_CREDS" write_standard_creds source-sendgrid "$SENDGRID_INTEGRATION_TEST_CREDS" write_standard_creds source-shopify "$SHOPIFY_INTEGRATION_TEST_CREDS" +write_standard_creds source-shortio "$SOURCE_SHORTIO_TEST_CREDS" write_standard_creds source-slack "$SOURCE_SLACK_TEST_CREDS" write_standard_creds source-smartsheets "$SMARTSHEETS_TEST_CREDS" write_standard_creds source-snapchat-marketing "$SOURCE_SNAPCHAT_MARKETING_CREDS"