airbyte-source-github 1.8.36.dev202507211247__py3-none-any.whl → 1.8.38__py3-none-any.whl

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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: airbyte-source-github
3
- Version: 1.8.36.dev202507211247
3
+ Version: 1.8.38
4
4
  Summary: Source implementation for GitHub.
5
5
  License: MIT
6
6
  Author: Airbyte
@@ -1,5 +1,5 @@
1
1
  source_github/__init__.py,sha256=punPc3v0mXEYOun7cbkfM5KUhgjv72B9DgDhI4VtzcQ,1134
2
- source_github/backoff_strategies.py,sha256=0BWPR4_EtguVIIhN1-_fsPExiGs40FuXrtK_4qxHeKg,2936
2
+ source_github/backoff_strategies.py,sha256=ChkWEmqZL7Qrr1zidOfjZWlMWIVRVO2yqZ7QE_HaZP8,2287
3
3
  source_github/config_migrations.py,sha256=H58hHqAnuvb0B8IXHW4aEDZ3HotEg7HdA2rXDG9XW7A,3832
4
4
  source_github/constants.py,sha256=Hj3Q4y7OoU-Iff4m9gEC2CjwmWJYXhNbHVNjg8EBLmQ,238
5
5
  source_github/errors_handlers.py,sha256=POqpvbrNAoZztjwByOJxJbIaxhWC8KWLi3gK1WzbiK8,7259
@@ -57,8 +57,8 @@ source_github/schemas/workflows.json,sha256=gSNw8WZaVKbX4AL97PbjZHzvxcOltXqv9Ao1
57
57
  source_github/source.py,sha256=1o8eayigi4xSUeNHdCd-mhNswGUq_XQrVk2eihTjm1o,14246
58
58
  source_github/spec.json,sha256=7LOQm01fP_RvPF-HifhNPJ7i0AxT2LTNPaLAA3uOfNY,7443
59
59
  source_github/streams.py,sha256=h5YMPLIsLTv7WX_mcURVC2LmmWBLraZvKH8J_GzV1IE,77441
60
- source_github/utils.py,sha256=SzjCYAOOtpzmpj7A3KOAMSlY-v2HSWOXOWUjxOk2Ges,5959
61
- airbyte_source_github-1.8.36.dev202507211247.dist-info/METADATA,sha256=NS3dCMe40d7sDPv3VEiGAp8__vLr6nGGKRb_hjhiEAk,5218
62
- airbyte_source_github-1.8.36.dev202507211247.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
63
- airbyte_source_github-1.8.36.dev202507211247.dist-info/entry_points.txt,sha256=gYhqVrTAZvMwuYByg0b_-o115yUFLLcfNxMrLZmiW9k,55
64
- airbyte_source_github-1.8.36.dev202507211247.dist-info/RECORD,,
60
+ source_github/utils.py,sha256=Ztd8VWwzTNUg_A96_8R9XSKorIcBa8wJ6aYUqygRkyk,5492
61
+ airbyte_source_github-1.8.38.dist-info/METADATA,sha256=9g93GnXyrKx4U9FOvJW85tZOyHDBJKkiaT9lhM-YW0k,5202
62
+ airbyte_source_github-1.8.38.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
63
+ airbyte_source_github-1.8.38.dist-info/entry_points.txt,sha256=gYhqVrTAZvMwuYByg0b_-o115yUFLLcfNxMrLZmiW9k,55
64
+ airbyte_source_github-1.8.38.dist-info/RECORD,,
@@ -12,10 +12,6 @@ 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
-
19
15
  def __init__(self, stream: HttpStream, **kwargs): # type: ignore # noqa
20
16
  self.stream = stream
21
17
  super().__init__(**kwargs)
@@ -27,30 +23,23 @@ class GithubStreamABCBackoffStrategy(BackoffStrategy):
27
23
  # `X-RateLimit-Reset` header which contains time when this hour will be finished and limits will be reset so
28
24
  # we again could have 5000 per another hour.
29
25
  if isinstance(response_or_exception, requests.Response):
26
+ min_backoff_time = 60.0
30
27
  retry_after = response_or_exception.headers.get("Retry-After")
31
28
  if retry_after is not None:
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)
29
+ backoff_time_in_seconds = max(float(retry_after), min_backoff_time)
30
+ return self.get_waiting_time(backoff_time_in_seconds)
34
31
 
35
32
  reset_time = response_or_exception.headers.get("X-RateLimit-Reset")
36
33
  if reset_time:
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)
34
+ backoff_time_in_seconds = max(float(reset_time) - time.time(), min_backoff_time)
35
+ return self.get_waiting_time(backoff_time_in_seconds)
39
36
  return None
40
37
 
41
- def get_waiting_time(self, backoff_time_in_seconds: float, response: requests.Response) -> Optional[float]:
38
+ def get_waiting_time(self, backoff_time_in_seconds: Optional[float]) -> Optional[float]:
42
39
  if backoff_time_in_seconds < 60 * 10: # type: ignore[operator]
43
40
  return backoff_time_in_seconds
44
41
  else:
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
-
42
+ self.stream._http_client._session.auth.update_token() # New token will be used in next request
54
43
  return 1
55
44
 
56
45
 
source_github/utils.py CHANGED
@@ -76,14 +76,8 @@ class MultipleTokenAuthenticatorWithRateLimiter(AbstractHeaderAuthenticator):
76
76
  return {self.auth_header: self.token}
77
77
  return {}
78
78
 
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
-
79
+ def __call__(self, request):
80
+ """Attach the HTTP headers required to authenticate on the HTTP request"""
87
81
  while True:
88
82
  current_token = self._tokens[self.current_active_token]
89
83
  if "graphql" in request.path_url:
@@ -93,11 +87,6 @@ class MultipleTokenAuthenticatorWithRateLimiter(AbstractHeaderAuthenticator):
93
87
  if self.process_token(current_token, "count_rest", "reset_at_rest"):
94
88
  break
95
89
 
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
-
101
90
  request.headers.update(self.get_auth_header())
102
91
 
103
92
  return request