1
0
mirror of synced 2026-01-12 15:02:16 -05:00
Files
airbyte/airbyte-integrations/bases/base-python/base_python/cdk/streams/auth/token.py
2021-09-27 10:45:50 -07:00

19 lines
538 B
Python

#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
from typing import Any, Mapping
from base_python.cdk.streams.auth.core import HttpAuthenticator
class TokenAuthenticator(HttpAuthenticator):
def __init__(self, token: str, auth_method: str = "Bearer", auth_header: str = "Authorization"):
self.auth_method = auth_method
self.auth_header = auth_header
self._token = token
def get_auth_header(self) -> Mapping[str, Any]:
return {self.auth_header: f"{self.auth_method} {self._token}"}