or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

authentication.mdindex.mdsource-configuration.mdstream-operations.md

source-configuration.mddocs/

0

# Source Configuration

1

2

Main source connector functionality for configuration, connection validation, and stream management. The SourceWebflow class implements Airbyte's AbstractSource interface and provides the core connector behavior.

3

4

## Capabilities

5

6

### Source Class

7

8

The main connector class that handles configuration, authentication, connection validation, and stream discovery.

9

10

```python { .api }

11

class SourceWebflow(AbstractSource):

12

"""Main source class for Webflow connector."""

13

```

14

15

### Connection Validation

16

17

Validates that the provided configuration can successfully connect to the Webflow API by attempting to read collection metadata.

18

19

```python { .api }

20

def check_connection(self, logger: logging.Logger, config: Mapping[str, Any]) -> Tuple[bool, any]:

21

"""

22

Validate connection to Webflow API.

23

24

Parameters:

25

- logger: Logger instance for connection status messages

26

- config: Configuration dictionary with api_key, site_id, and optional accept_version

27

28

Returns:

29

Tuple of (success_boolean, error_or_none)

30

"""

31

```

32

33

### Stream Discovery

34

35

Discovers available Webflow collections and generates corresponding stream objects for data extraction.

36

37

```python { .api }

38

def streams(self, config: Mapping[str, Any]) -> List[Stream]:

39

"""

40

Generate list of available streams based on Webflow collections.

41

42

Parameters:

43

- config: Configuration dictionary with authentication and site information

44

45

Returns:

46

List of Stream objects, one for each discovered Webflow collection

47

"""

48

```

49

50

### Stream Generation

51

52

Internal method that creates stream objects for each discovered collection.

53

54

```python { .api }

55

def generate_streams(self, authenticator: WebflowTokenAuthenticator, site_id: str) -> List[Stream]:

56

"""

57

Generate stream objects for each collection.

58

59

Parameters:

60

- authenticator: Configured Webflow authenticator instance

61

- site_id: Webflow site identifier

62

63

Returns:

64

Generator yielding CollectionContents stream objects

65

"""

66

```

67

68

### Authentication Factory

69

70

Static method to create properly configured authenticator instances from configuration.

71

72

```python { .api }

73

@staticmethod

74

def get_authenticator(config):

75

"""

76

Create WebflowTokenAuthenticator from configuration.

77

78

Parameters:

79

- config: Configuration dictionary containing api_key and optional accept_version

80

81

Returns:

82

WebflowTokenAuthenticator instance

83

84

Raises:

85

Exception: If api_key is missing from configuration

86

"""

87

```

88

89

### Collection Name Mapping

90

91

Internal utility to map collection names to their corresponding IDs for API calls.

92

93

```python { .api }

94

@staticmethod

95

def _get_collection_name_to_id_dict(authenticator = None, site_id: str = None) -> Mapping[str, str]:

96

"""

97

Create mapping from collection names to collection IDs.

98

99

Parameters:

100

- authenticator: Webflow authenticator instance

101

- site_id: Webflow site identifier

102

103

Returns:

104

Dictionary mapping collection names to their API IDs

105

"""

106

```

107

108

## Usage Examples

109

110

### Basic Connection Test

111

112

```python

113

from source_webflow import SourceWebflow

114

import logging

115

116

config = {

117

"api_key": "your_api_token",

118

"site_id": "your_site_id"

119

}

120

121

source = SourceWebflow()

122

logger = logging.getLogger()

123

124

success, error = source.check_connection(logger, config)

125

if success:

126

print("Connected successfully!")

127

else:

128

print(f"Connection failed: {error}")

129

```

130

131

### Discovering Available Streams

132

133

```python

134

from source_webflow import SourceWebflow

135

136

config = {

137

"api_key": "your_api_token",

138

"site_id": "your_site_id"

139

}

140

141

source = SourceWebflow()

142

streams = source.streams(config)

143

144

for stream in streams:

145

print(f"Collection: {stream.name}")

146

print(f"Schema: {stream.get_json_schema()}")

147

```

148

149

## Configuration Requirements

150

151

The configuration dictionary must contain:

152

153

- `api_key` (string, required): Webflow API token for authentication

154

- `site_id` (string, required): Identifier of the Webflow site to extract data from

155

- `accept_version` (string, optional): API version header, defaults to "1.0.0"

156

157

## Error Handling

158

159

Connection validation will return `(False, error)` for common issues:

160

161

- Invalid or missing API key

162

- Inaccessible site ID

163

- Network connectivity problems

164

- Webflow API errors or rate limiting

165

166

The error object contains details about the specific failure for debugging purposes.