airbyte-source-google-search-console 1.4.4__py3-none-any.whl → 1.4.6__py3-none-any.whl
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.dist-info → airbyte_source_google_search_console-1.4.6.dist-info}/METADATA +1 -1
- {airbyte_source_google_search_console-1.4.4.dist-info → airbyte_source_google_search_console-1.4.6.dist-info}/RECORD +5 -5
- source_google_search_console/streams.py +21 -3
- {airbyte_source_google_search_console-1.4.4.dist-info → airbyte_source_google_search_console-1.4.6.dist-info}/WHEEL +0 -0
- {airbyte_source_google_search_console-1.4.4.dist-info → airbyte_source_google_search_console-1.4.6.dist-info}/entry_points.txt +0 -0
@@ -19,8 +19,8 @@ source_google_search_console/schemas/sites.json,sha256=WNiCRuStPL1YkJiFa8FEbNJmq
|
|
19
19
|
source_google_search_console/service_account_authenticator.py,sha256=ocSisT5IYegoZf4atsGm9u2lJCdmeSf_9o4q7YN3vD4,1225
|
20
20
|
source_google_search_console/source.py,sha256=s-ZFiZ0iDL_OGOndO9tyBAoiiLSPtCf5kVmHWsxE25k,10029
|
21
21
|
source_google_search_console/spec.json,sha256=WYtFvaSqWYGm1Dt2yV9G92U78Q94rh9oarbxJe3H7xo,8470
|
22
|
-
source_google_search_console/streams.py,sha256=
|
23
|
-
airbyte_source_google_search_console-1.4.
|
24
|
-
airbyte_source_google_search_console-1.4.
|
25
|
-
airbyte_source_google_search_console-1.4.
|
26
|
-
airbyte_source_google_search_console-1.4.
|
22
|
+
source_google_search_console/streams.py,sha256=avllhiXP9DGuFBdiYEaaiKCog0bzskeRISCXGxSqiT4,19120
|
23
|
+
airbyte_source_google_search_console-1.4.6.dist-info/METADATA,sha256=3jKQ_vZslVlFWQcKNo6SobGXVJLAN5qZ91d2cAdZIAo,5619
|
24
|
+
airbyte_source_google_search_console-1.4.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
25
|
+
airbyte_source_google_search_console-1.4.6.dist-info/entry_points.txt,sha256=DMcgc9bCX-Vt6hm_68pa77qS3eGdeMhg-UdlFc-XKUM,85
|
26
|
+
airbyte_source_google_search_console-1.4.6.dist-info/RECORD,,
|
@@ -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"]
|
File without changes
|