airbyte-source-google-search-console 1.4.4__tar.gz → 1.4.5__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/PKG-INFO +1 -1
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/pyproject.toml +1 -1
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/streams.py +21 -3
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/README.md +0 -0
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/__init__.py +0 -0
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/config_migrations.py +0 -0
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/exceptions.py +0 -0
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/run.py +0 -0
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/schemas/search_analytics_all_fields.json +0 -0
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/schemas/search_analytics_by_country.json +0 -0
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/schemas/search_analytics_by_date.json +0 -0
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/schemas/search_analytics_by_device.json +0 -0
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/schemas/search_analytics_by_page.json +0 -0
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/schemas/search_analytics_by_query.json +0 -0
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/schemas/search_analytics_keyword_page_report.json +0 -0
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/schemas/search_analytics_keyword_site_report_by_page.json +0 -0
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/schemas/search_analytics_keyword_site_report_by_site.json +0 -0
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/schemas/search_analytics_page_report.json +0 -0
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/schemas/search_analytics_site_report_by_page.json +0 -0
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/schemas/search_analytics_site_report_by_site.json +0 -0
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/schemas/sitemaps.json +0 -0
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/schemas/sites.json +0 -0
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/service_account_authenticator.py +0 -0
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/source.py +0 -0
- {airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/source_google_search_console/spec.json +0 -0
@@ -10,6 +10,7 @@ from urllib.parse import quote_plus, unquote_plus
|
|
10
10
|
import pendulum
|
11
11
|
import requests
|
12
12
|
from airbyte_cdk.models import SyncMode
|
13
|
+
from airbyte_cdk.sources.streams import CheckpointMixin
|
13
14
|
from airbyte_cdk.sources.streams.http import HttpStream
|
14
15
|
from requests.auth import AuthBase
|
15
16
|
|
@@ -114,7 +115,7 @@ class Sitemaps(GoogleSearchConsole):
|
|
114
115
|
return f"sites/{stream_slice.get('site_url')}/sitemaps"
|
115
116
|
|
116
117
|
|
117
|
-
class SearchAnalytics(GoogleSearchConsole, ABC):
|
118
|
+
class SearchAnalytics(GoogleSearchConsole, CheckpointMixin, ABC):
|
118
119
|
"""
|
119
120
|
API docs: https://developers.google.com/webmaster-tools/search-console-api-original/v3/searchanalytics
|
120
121
|
"""
|
@@ -126,6 +127,10 @@ class SearchAnalytics(GoogleSearchConsole, ABC):
|
|
126
127
|
search_types = ["web", "news", "image", "video"]
|
127
128
|
range_of_days = 3
|
128
129
|
|
130
|
+
def __init__(self, authenticator: AuthBase, site_urls: list, start_date: str, end_date: str, data_state: str = "final", **kwargs):
|
131
|
+
super().__init__(authenticator=authenticator, site_urls=site_urls, start_date=start_date, end_date=end_date, data_state=data_state)
|
132
|
+
self._state = {}
|
133
|
+
|
129
134
|
def path(
|
130
135
|
self,
|
131
136
|
stream_state: Mapping[str, Any] = None,
|
@@ -142,6 +147,14 @@ class SearchAnalytics(GoogleSearchConsole, ABC):
|
|
142
147
|
def http_method(self) -> str:
|
143
148
|
return "POST"
|
144
149
|
|
150
|
+
@property
|
151
|
+
def state(self) -> MutableMapping[str, Any]:
|
152
|
+
return self._state
|
153
|
+
|
154
|
+
@state.setter
|
155
|
+
def state(self, value: MutableMapping[str, Any]):
|
156
|
+
self._state = value
|
157
|
+
|
145
158
|
def stream_slices(
|
146
159
|
self, sync_mode: SyncMode, cursor_field: List[str] = None, stream_state: Mapping[str, Any] = None
|
147
160
|
) -> Iterable[Optional[Mapping[str, Any]]]:
|
@@ -262,7 +275,7 @@ class SearchAnalytics(GoogleSearchConsole, ABC):
|
|
262
275
|
|
263
276
|
yield record
|
264
277
|
|
265
|
-
def
|
278
|
+
def _get_updated_state(
|
266
279
|
self,
|
267
280
|
current_stream_state: MutableMapping[str, Any],
|
268
281
|
latest_record: Mapping[str, Any],
|
@@ -290,7 +303,7 @@ class SearchAnalytics(GoogleSearchConsole, ABC):
|
|
290
303
|
}
|
291
304
|
"""
|
292
305
|
|
293
|
-
latest_benchmark = latest_record
|
306
|
+
latest_benchmark = latest_record.get(self.cursor_field)
|
294
307
|
|
295
308
|
site_url = latest_record.get("site_url")
|
296
309
|
search_type = latest_record.get("search_type")
|
@@ -306,6 +319,11 @@ class SearchAnalytics(GoogleSearchConsole, ABC):
|
|
306
319
|
|
307
320
|
return current_stream_state
|
308
321
|
|
322
|
+
def read_records(self, **kwargs) -> Iterable[Mapping[str, Any]]:
|
323
|
+
for record in super().read_records(**kwargs):
|
324
|
+
self.state = self._get_updated_state(self.state, record)
|
325
|
+
yield record
|
326
|
+
|
309
327
|
|
310
328
|
class SearchAnalyticsByDate(SearchAnalytics):
|
311
329
|
primary_key = ["site_url", "date", "search_type"]
|
{airbyte_source_google_search_console-1.4.4 → airbyte_source_google_search_console-1.4.5}/README.md
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|