airbyte-source-github 1.8.35__tar.gz → 1.8.36.dev202507211247__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of airbyte-source-github might be problematic. Click here for more details.
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/PKG-INFO +1 -1
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/pyproject.toml +1 -1
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/backoff_strategies.py +18 -7
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/utils.py +13 -2
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/README.md +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/__init__.py +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/config_migrations.py +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/constants.py +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/errors_handlers.py +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/github_schema.py +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/graphql.py +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/run.py +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/assignees.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/branches.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/collaborators.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/comments.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/commit_comment_reactions.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/commit_comments.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/commits.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/contributor_activity.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/deployments.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/events.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/issue_comment_reactions.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/issue_events.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/issue_labels.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/issue_milestones.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/issue_reactions.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/issue_timeline_events.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/issues.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/organizations.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/project_cards.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/project_columns.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/projects.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/projects_v2.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/pull_request_comment_reactions.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/pull_request_commits.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/pull_request_stats.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/pull_requests.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/releases.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/repositories.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/review_comments.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/reviews.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/shared/events/comment.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/shared/events/commented.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/shared/events/committed.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/shared/events/cross_referenced.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/shared/events/reviewed.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/shared/reaction.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/shared/reactions.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/shared/user.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/shared/user_graphql.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/stargazers.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/tags.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/team_members.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/team_memberships.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/teams.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/users.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/workflow_jobs.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/workflow_runs.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/schemas/workflows.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/source.py +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/spec.json +0 -0
- {airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/streams.py +0 -0
|
@@ -12,6 +12,10 @@ from airbyte_cdk.sources.streams.http import HttpStream
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class GithubStreamABCBackoffStrategy(BackoffStrategy):
|
|
15
|
+
min_backoff_time = 60.0
|
|
16
|
+
# https://docs.github.com/en/rest/using-the-rest-api/troubleshooting-the-rest-api?apiVersion=2022-11-28
|
|
17
|
+
RATE_LIMITS_STATUS_CODES = [403, 429]
|
|
18
|
+
|
|
15
19
|
def __init__(self, stream: HttpStream, **kwargs): # type: ignore # noqa
|
|
16
20
|
self.stream = stream
|
|
17
21
|
super().__init__(**kwargs)
|
|
@@ -23,23 +27,30 @@ class GithubStreamABCBackoffStrategy(BackoffStrategy):
|
|
|
23
27
|
# `X-RateLimit-Reset` header which contains time when this hour will be finished and limits will be reset so
|
|
24
28
|
# we again could have 5000 per another hour.
|
|
25
29
|
if isinstance(response_or_exception, requests.Response):
|
|
26
|
-
min_backoff_time = 60.0
|
|
27
30
|
retry_after = response_or_exception.headers.get("Retry-After")
|
|
28
31
|
if retry_after is not None:
|
|
29
|
-
backoff_time_in_seconds = max(float(retry_after), min_backoff_time)
|
|
30
|
-
return self.get_waiting_time(backoff_time_in_seconds)
|
|
32
|
+
backoff_time_in_seconds = max(float(retry_after), self.min_backoff_time)
|
|
33
|
+
return self.get_waiting_time(backoff_time_in_seconds, response_or_exception)
|
|
31
34
|
|
|
32
35
|
reset_time = response_or_exception.headers.get("X-RateLimit-Reset")
|
|
33
36
|
if reset_time:
|
|
34
|
-
backoff_time_in_seconds = max(float(reset_time) - time.time(), min_backoff_time)
|
|
35
|
-
return self.get_waiting_time(backoff_time_in_seconds)
|
|
37
|
+
backoff_time_in_seconds = max(float(reset_time) - time.time(), self.min_backoff_time)
|
|
38
|
+
return self.get_waiting_time(backoff_time_in_seconds, response_or_exception)
|
|
36
39
|
return None
|
|
37
40
|
|
|
38
|
-
def get_waiting_time(self, backoff_time_in_seconds:
|
|
41
|
+
def get_waiting_time(self, backoff_time_in_seconds: float, response: requests.Response) -> Optional[float]:
|
|
39
42
|
if backoff_time_in_seconds < 60 * 10: # type: ignore[operator]
|
|
40
43
|
return backoff_time_in_seconds
|
|
41
44
|
else:
|
|
42
|
-
|
|
45
|
+
# New token will be used in the next request or fail if all tokens are exhausted
|
|
46
|
+
if response.status_code in self.RATE_LIMITS_STATUS_CODES:
|
|
47
|
+
self.stream._http_client._session.auth.find_available_token(response.request)
|
|
48
|
+
else:
|
|
49
|
+
self.stream._http_client._session.auth.update_token()
|
|
50
|
+
|
|
51
|
+
# update headers in the request itself so the next request will use new token
|
|
52
|
+
response.request.headers.update(self.stream._http_client._session.auth.get_auth_header())
|
|
53
|
+
|
|
43
54
|
return 1
|
|
44
55
|
|
|
45
56
|
|
{airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/utils.py
RENAMED
|
@@ -76,8 +76,14 @@ class MultipleTokenAuthenticatorWithRateLimiter(AbstractHeaderAuthenticator):
|
|
|
76
76
|
return {self.auth_header: self.token}
|
|
77
77
|
return {}
|
|
78
78
|
|
|
79
|
-
def
|
|
80
|
-
"""
|
|
79
|
+
def find_available_token(self, request: requests.Request):
|
|
80
|
+
"""
|
|
81
|
+
Iterates over each provided token and check their availability.
|
|
82
|
+
If no tokens are available or reset time is more than 10 minutes, an error is raised.
|
|
83
|
+
Method process_token() returns True is current token is available,
|
|
84
|
+
otherwise goes to the next token and sets it as current and checks for availability.
|
|
85
|
+
"""
|
|
86
|
+
|
|
81
87
|
while True:
|
|
82
88
|
current_token = self._tokens[self.current_active_token]
|
|
83
89
|
if "graphql" in request.path_url:
|
|
@@ -87,6 +93,11 @@ class MultipleTokenAuthenticatorWithRateLimiter(AbstractHeaderAuthenticator):
|
|
|
87
93
|
if self.process_token(current_token, "count_rest", "reset_at_rest"):
|
|
88
94
|
break
|
|
89
95
|
|
|
96
|
+
def __call__(self, request):
|
|
97
|
+
"""Attach the HTTP headers required to authenticate on the HTTP request"""
|
|
98
|
+
|
|
99
|
+
self.find_available_token(request)
|
|
100
|
+
|
|
90
101
|
request.headers.update(self.get_auth_header())
|
|
91
102
|
|
|
92
103
|
return request
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{airbyte_source_github-1.8.35 → airbyte_source_github-1.8.36.dev202507211247}/source_github/run.py
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
|
|
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
|
|
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
|