Skip to content

Commit

Permalink
Bulk update deprecated authenticators (#40549)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristoGrab authored and xiaohansong committed Jul 2, 2024
1 parent 4c01564 commit e735e5e
Show file tree
Hide file tree
Showing 46 changed files with 58 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: 6cbea164-3237-433b-9abb-36d384ee4cbf
dockerImageTag: 0.1.5
dockerImageTag: 0.1.6
dockerRepository: airbyte/source-gridly
githubIssueLabel: source-gridly
icon: gridly.svg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
version = "0.1.5"
version = "0.1.6"
name = "source-gridly"
description = "Source implementation for Gridly."
authors = [ "Airbyte <contact@airbyte.io>",]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from airbyte_cdk.sources import AbstractSource
from airbyte_cdk.sources.streams import Stream
from airbyte_cdk.sources.streams.http import HttpStream
from airbyte_cdk.sources.streams.http.auth import TokenAuthenticator
from airbyte_cdk.sources.streams.http.requests_native_auth import TokenAuthenticator
from source_gridly.helpers import Helpers


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from base64 import b64encode
from typing import Any, List, Mapping

from airbyte_cdk.sources.streams.http.auth import TokenAuthenticator
from airbyte_cdk.sources.streams.http.requests_native_auth import TokenAuthenticator
from streams import (
DashboardsGenerator,
FiltersGenerator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

class GeneratorMixin:
def get_generate_headers(self):
headers = {"Accept": "application/json", "Content-Type": "application/json", **self.authenticator.get_auth_header()}
headers = {"Accept": "application/json", "Content-Type": "application/json", **self._session.auth.get_auth_header()}
return headers

def generate_record(
Expand Down Expand Up @@ -84,7 +84,7 @@ class FilterSharingGenerator(FilterSharing, GeneratorMixin):
"""

def generate(self):
filters_stream = Filters(authenticator=self.authenticator, domain=self._domain)
filters_stream = Filters(authenticator=self._session.auth, domain=self._domain)
for filters in filters_stream.read_records(sync_mode=SyncMode.full_refresh):
for index in range(random.randrange(4)):
group_name = random.choice(["Test group 0", "Test group 1", "Test group 2"])
Expand Down Expand Up @@ -142,7 +142,7 @@ class IssueCommentsGenerator(IssueComments, GeneratorMixin):
"""

def generate(self):
issues_stream = Issues(authenticator=self.authenticator, domain=self._domain)
issues_stream = Issues(authenticator=self._session.auth, domain=self._domain)
for issue in issues_stream.read_records(sync_mode=SyncMode.full_refresh):
for index in range(20):
payload = json.dumps(
Expand Down Expand Up @@ -195,7 +195,7 @@ class IssueRemoteLinksGenerator(IssueRemoteLinks, GeneratorMixin):
"""

def generate(self):
issues_stream = Issues(authenticator=self.authenticator, domain=self._domain)
issues_stream = Issues(authenticator=self._session.auth, domain=self._domain)
for issue in issues_stream.read_records(sync_mode=SyncMode.full_refresh):
payload = json.dumps(
{
Expand Down Expand Up @@ -227,7 +227,7 @@ class IssueVotesGenerator(IssueVotes, GeneratorMixin):
"""

def generate(self):
issues_stream = Issues(authenticator=self.authenticator, domain=self._domain)
issues_stream = Issues(authenticator=self._session.auth, domain=self._domain)
for issue in issues_stream.read_records(sync_mode=SyncMode.full_refresh):
payload = None
self.generate_record(payload, stream_slice={"key": issue["key"]})
Expand All @@ -239,7 +239,7 @@ class IssueWatchersGenerator(IssueWatchers, GeneratorMixin):
"""

def generate(self):
issues_stream = Issues(authenticator=self.authenticator, domain=self._domain)
issues_stream = Issues(authenticator=self._session.auth, domain=self._domain)
for issue in issues_stream.read_records(sync_mode=SyncMode.full_refresh):
payload = None
self.generate_record(payload, stream_slice={"key": issue["key"]})
Expand All @@ -251,7 +251,7 @@ class IssueWorklogsGenerator(IssueWorklogs, GeneratorMixin):
"""

def generate(self):
issues_stream = Issues(authenticator=self.authenticator, domain=self._domain)
issues_stream = Issues(authenticator=self._session.auth, domain=self._domain)
for issue in issues_stream.read_records(sync_mode=SyncMode.full_refresh):
for index in range(random.randrange(1, 6)):
payload = json.dumps(
Expand Down Expand Up @@ -312,7 +312,7 @@ def path(self, **kwargs) -> str:
return "component"

def generate(self):
projects_stream = Projects(authenticator=self.authenticator, domain=self._domain)
projects_stream = Projects(authenticator=self._session.auth, domain=self._domain)
for project in projects_stream.read_records(sync_mode=SyncMode.full_refresh):
for index in range(random.randrange(6)):
payload = json.dumps(
Expand All @@ -337,7 +337,7 @@ def path(self, **kwargs) -> str:
return "version"

def generate(self):
projects_stream = Projects(authenticator=self.authenticator, domain=self._domain)
projects_stream = Projects(authenticator=self._session.auth, domain=self._domain)
for project in projects_stream.read_records(sync_mode=SyncMode.full_refresh):
for index in range(random.randrange(6)):
payload = json.dumps(
Expand Down
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-jira/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: 68e63de2-bb83-4c7e-93fa-a8a9051e3993
dockerImageTag: 3.0.3
dockerImageTag: 3.0.4
dockerRepository: airbyte/source-jira
documentationUrl: https://docs.airbyte.com/integrations/sources/jira
githubIssueLabel: source-jira
Expand Down
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-jira/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
version = "3.0.3"
version = "3.0.4"
name = "source-jira"
description = "Source implementation for Jira."
authors = [ "Airbyte <contact@airbyte.io>",]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ class Issues(IncrementalJiraStream):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self._project_ids = []
self.issue_fields_stream = IssueFields(authenticator=self.authenticator, domain=self._domain, projects=self._projects)
self.projects_stream = Projects(authenticator=self.authenticator, domain=self._domain, projects=self._projects)
self.issue_fields_stream = IssueFields(authenticator=self._session.auth, domain=self._domain, projects=self._projects)
self.projects_stream = Projects(authenticator=self._session.auth, domain=self._domain, projects=self._projects)

def path(self, **kwargs) -> str:
return "search"
Expand Down Expand Up @@ -340,7 +340,7 @@ class IssueWorklogs(IncrementalJiraStream):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.issues_stream = Issues(
authenticator=self.authenticator,
authenticator=self._session.auth,
domain=self._domain,
projects=self._projects,
start_date=self._start_date,
Expand Down Expand Up @@ -370,7 +370,7 @@ class IssueComments(IncrementalJiraStream):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.issues_stream = Issues(
authenticator=self.authenticator,
authenticator=self._session.auth,
domain=self._domain,
projects=self._projects,
start_date=self._start_date,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: 7b86879e-26c5-4ef6-a5ce-2be5c7b46d1e
dockerImageTag: 0.1.12
dockerImageTag: 0.1.13
dockerRepository: airbyte/source-linnworks
documentationUrl: https://docs.airbyte.com/integrations/sources/linnworks
githubIssueLabel: source-linnworks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
version = "0.1.12"
version = "0.1.13"
name = "source-linnworks"
description = "Source implementation for Linnworks."
authors = [ "Airbyte <contact@airbyte.io>",]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self, authenticator: Union[AuthBase, HttpAuthenticator] = None, sta

@property
def url_base(self) -> str:
return self.authenticator.get_server()
return self._session.auth.get_server()

def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, Any]]:
return None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: 12928b32-bf0a-4f1e-964f-07e12e37153a
dockerImageTag: 3.1.4
dockerImageTag: 3.1.5
dockerRepository: airbyte/source-mixpanel
documentationUrl: https://docs.airbyte.com/integrations/sources/mixpanel
githubIssueLabel: source-mixpanel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
version = "3.1.4"
version = "3.1.5"
name = "source-mixpanel"
description = "Source implementation for Mixpanel."
authors = ["Airbyte <contact@airbyte.io>"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from datetime import date, timedelta

import pendulum
from airbyte_cdk.sources.streams.http.auth import NoAuth
from source_mixpanel.streams import Export


Expand All @@ -15,7 +14,7 @@ def test_date_slices():

# test with stream_state
stream_slices = Export(
authenticator=NoAuth(),
authenticator=None,
start_date=date.fromisoformat("2021-07-01"),
end_date=date.fromisoformat("2021-07-03"),
date_window_size=1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: ad15c7ba-72a7-440b-af15-b9a963dc1a8a
dockerImageTag: 0.1.5
dockerImageTag: 0.1.6
dockerRepository: airbyte/source-pardot
githubIssueLabel: source-pardot
icon: salesforcepardot.svg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
version = "0.1.5"
version = "0.1.6"
name = "source-pardot"
description = "Source implementation for Pardot."
authors = [ "Airbyte <contact@airbyte.io>",]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from airbyte_cdk.sources import AbstractSource
from airbyte_cdk.sources.streams import Stream
from airbyte_cdk.sources.streams.http.auth import TokenAuthenticator
from airbyte_cdk.sources.streams.http.requests_native_auth import TokenAuthenticator

from .api import Pardot
from .stream import Campaigns, EmailClicks, ListMembership, Lists, ProspectAccounts, Prospects, Users, VisitorActivities, Visitors, Visits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from airbyte_cdk.sources import AbstractSource
from airbyte_cdk.sources.streams import Stream
from airbyte_cdk.sources.streams.http import HttpStream
from airbyte_cdk.sources.streams.http.auth import NoAuth


class ExchangeRates(HttpStream):
Expand Down Expand Up @@ -106,10 +105,10 @@ def check_connection(self, logger, config) -> Tuple[bool, any]:
return True, None

def streams(self, config: Mapping[str, Any]) -> List[Stream]:
# NoAuth just means there is no authentication required for this API. It's only included for completeness
# No authentication is required for this API. It's only included for completeness
# of the example, but if you don't need authentication, you don't need to pass an authenticator at all.
# Other authenticators are available for API token-based auth and Oauth2.
auth = NoAuth()
auth = None
# Parse the date from a string into a datetime object
start_date = datetime.strptime(config["start_date"], "%Y-%m-%d")
return [ExchangeRates(authenticator=auth, config=config, start_date=start_date)]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: fb141f29-be2a-450b-a4f2-2cd203a00f84
dockerImageTag: 0.1.8
dockerImageTag: 0.1.9
dockerRepository: airbyte/source-rd-station-marketing
githubIssueLabel: source-rd-station-marketing
icon: rdstation.svg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
version = "0.1.8"
version = "0.1.9"
name = "source-rd-station-marketing"
description = "Source implementation for RD Station Marketing."
authors = [ "Airbyte <contact@airbyte.io>",]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from airbyte_cdk.models import SyncMode
from airbyte_cdk.sources import AbstractSource
from airbyte_cdk.sources.streams import Stream
from airbyte_cdk.sources.streams.http.auth import Oauth2Authenticator
from airbyte_cdk.sources.streams.http.requests_native_auth import Oauth2Authenticator
from source_rd_station_marketing.streams import (
AnalyticsConversions,
AnalyticsEmails,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: badc5925-0485-42be-8caa-b34096cb71b5
dockerImageTag: 0.3.7
dockerImageTag: 0.3.8
dockerRepository: airbyte/source-surveymonkey
documentationUrl: https://docs.airbyte.com/integrations/sources/surveymonkey
githubIssueLabel: source-surveymonkey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
version = "0.3.7"
version = "0.3.8"
name = "source-surveymonkey"
description = "Source implementation for Surveymonkey."
authors = [ "Airbyte <contact@airbyte.io>",]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import pytest
from airbyte_cdk.models import SyncMode
from airbyte_cdk.sources.declarative.incremental.per_partition_cursor import StreamSlice
from airbyte_cdk.sources.streams.http.auth import NoAuth
from source_surveymonkey.source import SourceSurveymonkey


Expand All @@ -34,7 +33,7 @@ def read_records(stream_name, slice=StreamSlice(partition={"survey_id": "3077854
@pytest.fixture
def args_mock():
return {
"authenticator": NoAuth(),
"authenticator": None,
"start_date": pendulum.parse("2000-01-01"),
"survey_ids": []
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import pendulum
import pytest
from airbyte_cdk.sources.streams.http.auth import TokenAuthenticator
from airbyte_cdk.sources.streams.http.requests_native_auth import TokenAuthenticator
from source_surveymonkey.streams import Surveys


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: c4cfaeda-c757-489a-8aba-859fb08b6970
dockerImageTag: 0.1.7
dockerImageTag: 0.1.8
dockerRepository: airbyte/source-us-census
githubIssueLabel: source-us-census
icon: uscensus.svg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
version = "0.1.7"
version = "0.1.8"
name = "source-us-census"
description = "Source implementation for Us Census."
authors = [ "Airbyte <contact@airbyte.io>",]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from airbyte_cdk.sources import AbstractSource
from airbyte_cdk.sources.streams import Stream
from airbyte_cdk.sources.streams.http import HttpStream
from airbyte_cdk.sources.streams.http.auth import NoAuth


def prepare_request_params(query_params: str, api_key: str) -> dict:
Expand Down Expand Up @@ -213,6 +212,6 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]:
query_params=config.get("query_params"),
query_path=config.get("query_path"),
api_key=config.get("api_key"),
authenticator=NoAuth(),
authenticator=None,
)
]
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import pytest
import requests
import responses
from airbyte_cdk.sources.streams.http.auth import NoAuth
from source_us_census.source import UsCensusStream


Expand All @@ -16,7 +15,7 @@ def us_census_stream():
query_params={},
query_path="data/test",
api_key="MY_API_KEY",
authenticator=NoAuth(),
authenticator=None,
)


Expand Down
Loading

0 comments on commit e735e5e

Please sign in to comment.