* Added webflow code * Updated readme * Updated README * Added webflow to source_definitions.yaml * Enhanced documentation for the Webflow source connector * Improved webflow source connector instructions * Moved Site ID to before API token in Spec.yaml (for presentation in the UI) * Addressed comments in PR. * Changes to address requests in PR review * Removed version from config * Minor udpate to spec.yaml for clarity * Updated to pass the accept-version as a constant rather than parameter * Updated check_connection to hit the collections API that requires both site id and the authentication token. * Fixed the test_check_connection to use the new check_connection function * Added a streams test for generate_streams * Re-named "autentication" object to "auth" to be more consistent with the way it is created by the CDK * Added in an explict line to instantiante an "auth" object from WebflowTokenAuthenticator, to make it easier to describe in the blog * Fixed a typo in a comment * Renamed some classes to be more intuitive * Renamed class to be more intuitive * Minor change to an internal method name * Made _get_collection_name_to_id_dict staticmethod * Fixed a unit-test error that only appeared when running " python -m pytest -s unit_tests". This was caused by Mocked settings from test_source.py leaking into test_streams.py * format: add double quotes and remove unused import * readme: remove semantic version naming of connector in build commands * Updated spec.yaml * auto-bump connector version * format files * add changelog * update dockerfile * auto-bump connector version Co-authored-by: sajarin <sajarindider@gmail.com> Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com> Co-authored-by: marcosmarxm <marcosmarxm@gmail.com>
29 lines
945 B
Python
29 lines
945 B
Python
#
|
|
# Copyright (c) 2022 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
|
|
"""
|