1
0
mirror of synced 2025-12-31 06:05:12 -05:00
Files
airbyte/airbyte-integrations/connectors/source-webflow/source_webflow/auth.py
Cole Snodgrass 2e099acc52 update headers from 2022 -> 2023 (#22594)
* It's 2023!

* 2022 -> 2023

---------

Co-authored-by: evantahler <evan@airbyte.io>
2023-02-08 13:01:16 -08:00

29 lines
945 B
Python

#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
from typing import Any, Mapping
from airbyte_cdk.sources.streams.http.requests_native_auth import TokenAuthenticator
class WebflowAuthMixin:
"""
Mixin class for providing additional HTTP header for specifying the "accept-version"
"""
def __init__(self, *, accept_version_header: str = "accept-version", accept_version: str, **kwargs):
super().__init__(**kwargs)
self.accept_version = accept_version
self.accept_version_header = accept_version_header
def get_auth_header(self) -> Mapping[str, Any]:
return {**super().get_auth_header(), self.accept_version_header: self.accept_version}
class WebflowTokenAuthenticator(WebflowAuthMixin, TokenAuthenticator):
"""
Auth class for Personal Access Token
https://help.getharvest.com/api-v2/authentication-api/authentication/authentication/#personal-access-tokens
"""