Skip to content

Commit

Permalink
Update source.py
Browse files Browse the repository at this point in the history
  • Loading branch information
koconder committed Oct 5, 2022
1 parent 10d996e commit af5e79a
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,14 @@ def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) ->
"""
Testing connection availability for the connector by granting the token.
"""
auth = ZuoraAuthenticator(config).get_auth()
try:
auth.get_auth_header()
url = f"{config['domain_url']}/query/jobs"

authenticator = ZuoraAuthenticator(config)

session = requests.get(url, headers=authenticator.get_auth_header())
session.raise_for_status()

return True, None
except Exception as e:
return False, e
Expand All @@ -516,7 +521,7 @@ def streams(self, config: Mapping[str, Any]) -> List[ZuoraStream]:
Defining streams to run by building stream classes dynamically.
"""
auth = ZuoraAuthenticator(config)
config["authenticator"] = auth.get_auth()
config["authenticator"] = auth
config["url_base"] = auth.url_base

# List available objects (streams) names from Zuora
Expand Down

0 comments on commit af5e79a

Please sign in to comment.