Skip to content

Commit

Permalink
source-hubspot: update to estuary-cdk
Browse files Browse the repository at this point in the history
  • Loading branch information
jgraettinger committed Mar 11, 2024
1 parent 7fb3158 commit 966cc06
Show file tree
Hide file tree
Showing 50 changed files with 1,229 additions and 433 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ jobs:
- connector: source-shopify
connector_type: capture
python: true
- connector: source-hubspot
connector_type: capture
python: true

steps:
- uses: actions/checkout@v2
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
- "source-google-ads/**"
- "source-google-sheets-native/**"
- "source-hubspot-native/**"
- "source-hubspot/**"
pull_request:
branches: [main]
paths:
Expand All @@ -23,6 +24,7 @@ on:
- "source-google-ads/**"
- "source-google-sheets-native/**"
- "source-hubspot-native/**"
- "source-hubspot/**"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -50,10 +52,6 @@ jobs:
type: capture
version: v4
usage_rate: "1.0"
- name: source-hubspot-native
type: capture
version: v1
usage_rate: "1.0"
- name: source-gladly
type: capture
version: v1
Expand All @@ -66,6 +64,14 @@ jobs:
type: capture
version: v1
usage_rate: "0.0"
- name: source-hubspot-native
type: capture
version: v1
usage_rate: "1.0"
- name: source-hubspot
type: capture
version: v5
usage_rate: "1.0"

steps:
- uses: actions/checkout@v4
Expand Down
58 changes: 0 additions & 58 deletions source-hubspot/__main__.py

This file was deleted.

1 change: 0 additions & 1 deletion source-hubspot/icon.svg

This file was deleted.

1,077 changes: 867 additions & 210 deletions source-hubspot/poetry.lock

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions source-hubspot/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
[tool.poetry]
name = "source-hubspot"
name = "source_hubspot"
version = "0.1.0"
description = ""
authors = ["Johnny Graettinger <[email protected]>"]

[tool.poetry.dependencies]
python = ">=3.11,<3.12"
flow-sdk = {path="../python", develop=true}
airbyte-cdk = "0.51.14"
backoff = "^1.11"
pendulum = "^3.0.0"
airbyte-cdk = "^0.52"
estuary-cdk = {path="../estuary-cdk", develop = true}
python = "^3.11"
types-requests = "^2.31"

[tool.poetry.group.dev.dependencies]
debugpy = "^1.8.0"
mypy = "^1.8.0"
pytest = "^7.4.3"
pytest-insta = "^0.2.0"
mock = "^5.1.0"
pytest-mock = "^3.12.0"
pytest-insta = "^0.3.0"
requests-mock = "^1.11.0"
debugpy = "^1.8.0"
pytest-mock = "^3.12.0"
mock = "^5.1.0"

[build-system]
requires = ["poetry-core"]
Expand Down
63 changes: 63 additions & 0 deletions source-hubspot/source_hubspot/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import estuary_cdk.pydantic_polyfill # Must be first.

import asyncio
import urllib
from estuary_cdk import shim_airbyte_cdk, flow
from source_hubspot import SourceHubspot

scopes = [
"oauth",
"forms",
"files",
"tickets",
"e-commerce",
"sales-email-read",
"forms-uploaded-files",
"crm.lists.read",
"crm.objects.contacts.read",
"files.ui_hidden.read",
"crm.schemas.contacts.read",
"crm.objects.companies.read",
"crm.objects.deals.read",
"crm.schemas.companies.read",
"crm.schemas.deals.read",
"crm.objects.owners.read",
]

optional_scopes = [
"content",
"automation",
"crm.objects.feedback_submissions.read",
]

asyncio.run(
shim_airbyte_cdk.CaptureShim(
delegate=SourceHubspot(),
oauth2=flow.OAuth2Spec(
provider="hubspot",
authUrlTemplate=(
"https://app.hubspot.com/oauth/authorize?"
r"client_id={{#urlencode}}{{{ client_id }}}{{/urlencode}}"
r"&scope="
+ urllib.parse.quote(" ".join(scopes))
+ r"&optional_scope="
+ urllib.parse.quote(" ".join(optional_scopes))
+ r"&redirect_uri={{#urlencode}}{{{ redirect_uri }}}{{/urlencode}}"
r"&response_type=code&state={{#urlencode}}{{{ state }}}{{/urlencode}}"
),
accessTokenUrlTemplate="https://api.hubapi.com/oauth/v1/token",
accessTokenHeaders={"content-type": "application/x-www-form-urlencoded"},
accessTokenBody=(
"grant_type=authorization_code"
r"&client_id={{#urlencode}}{{{ client_id }}}{{/urlencode}}"
r"&client_secret={{#urlencode}}{{{ client_secret }}}{{/urlencode}}"
r"&redirect_uri={{#urlencode}}{{{ redirect_uri }}}{{/urlencode}}"
r"&code={{#urlencode}}{{{ code }}}{{/urlencode}}"
),
accessTokenResponseMap={
"refresh_token": "/refresh_token",
},
),
schema_inference=False,
).serve()
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion source-hubspot/test.flow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ captures:
# - "0.0.0.0:5678"
# - "--wait-for-client"
- "-m"
- source-hubspot
- source_hubspot
config: config.yaml
bindings:
- resource:
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 966cc06

Please sign in to comment.