Daniel Eduardo Portugal Revilla
01/21/2022, 1:31 PM{
"type": "LOG",
"log": {
"level": "FATAL",
"message": "HttpStream.__init__() got an unexpected keyword argument 'auth'\nTraceback (most recent call last):\n File \"/Users/daniel_edu/Projects/PERSONAL/airbyte/airbyte-integrations/connectors/source-servicesnow-api/main.py\", line 13, in <module>\n launch(source, sys.argv[1:])\n File \"/Users/daniel_edu/Projects/PERSONAL/airbyte/airbyte-integrations/connectors/source-servicesnow-api/.env/lib/python3.10/site-packages/airbyte_cdk/entrypoint.py\", line 127, in launch\n for message in source_entrypoint.run(parsed_args):\n File \"/Users/daniel_edu/Projects/PERSONAL/airbyte/airbyte-integrations/connectors/source-servicesnow-api/.env/lib/python3.10/site-packages/airbyte_cdk/entrypoint.py\", line 118, in run\n for message in generator:\n File \"/Users/daniel_edu/Projects/PERSONAL/airbyte/airbyte-integrations/connectors/source-servicesnow-api/.env/lib/python3.10/site-packages/airbyte_cdk/sources/abstract_source.py\", line 92, in read\n stream_instances = {s.name: s for s in self.streams(config)}\n File \"/Users/daniel_edu/Projects/PERSONAL/airbyte/airbyte-integrations/connectors/source-servicesnow-api/source_servicesnow_api/source.py\", line 55, in streams\n return [ServicesnowApi(auth=(config[\"psswrd\"], config[\"psswrd\"]), user=config[\"user\"], psswrd=config[\"psswrd\"])]\n File \"/Users/daniel_edu/Projects/PERSONAL/airbyte/airbyte-integrations/connectors/source-servicesnow-api/source_servicesnow_api/source.py\", line 67, in __init__\n super().__init__(**kwargs)\nTypeError: HttpStream.__init__() got an unexpected keyword argument 'auth'"
}
}
I was trying this script
def streams(self, config: Mapping[str, Any]) -> List[Stream]:
"""
TODO: Replace the streams below with your own streams.
:param config: A Mapping of the user input configuration as defined in the connector spec.
"""
# TODO remove the authenticator if not required.
auth = TokenAuthenticator(token="api_key") # Oauth2Authenticator is also available if you need oauth support
return [ServicesnowApi(authenticator=(config["psswrd"], config["psswrd"]))]
Augustin Lafanechere (Airbyte)
01/21/2022, 2:00 PM• _*API Key*_: A unique code provided by the REST API to identify the calling application or user.
• _*Basic Authentication*_: A user name and password combination used to authenticate to the REST API.
• _*OAuth 2.0*_: An authentication provider provides a secret and uses that information to grant access to a resource. OAuth is beyond the scope of this training module
Daniel Eduardo Portugal Revilla
01/21/2022, 2:07 PM# Do the HTTP request
response = requests.get(url_sn, auth=(username, password))
# Check for HTTP codes other than 200
if response.status_code != 200:
print('Status:', response.status_code, 'Headers:', response.headers, 'Error Response:', response.json())
exit()
data = response.json()
print(data)
Daniel Eduardo Portugal Revilla
01/21/2022, 2:07 PMAugustin Lafanechere (Airbyte)
01/21/2022, 2:19 PMDaniel Eduardo Portugal Revilla
01/21/2022, 2:59 PMdef streams(self, config: Mapping[str, Any]) -> List[Stream]:
auth = HTTPBasicAuth(config["user"], config["psswrd"]) # Oauth2Authenticator is also available if you need oauth support
return [ServicesnowApi(authenticator=auth)]