Skip to content

Commit 4318b31

Browse files
refactor: Override authenticate_request in GitHubTokenAuthenticator
1 parent 88b779d commit 4318b31

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

tap_github/authenticator.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -359,24 +359,18 @@ def update_rate_limit(
359359

360360
self.active_token.update_rate_limit(response_headers)
361361

362-
@property
363-
def auth_headers(self) -> dict[str, str]:
364-
"""Return a dictionary of auth headers to be applied.
365-
366-
These will be merged with any `http_headers` specified in the stream.
367-
368-
Returns:
369-
HTTP headers for authentication.
370-
"""
371-
result = super().auth_headers
362+
def authenticate_request(
363+
self,
364+
request: requests.PreparedRequest,
365+
) -> requests.PreparedRequest:
372366
if self.active_token:
373367
# Make sure that our token is still valid or update it.
374368
if not self.active_token.has_calls_remaining():
375369
self.get_next_auth_token()
376-
result["Authorization"] = f"token {self.active_token.token}"
370+
request.headers["Authorization"] = f"token {self.active_token.token}"
377371
else:
378372
self.logger.info(
379373
"No auth token detected. "
380374
"For higher rate limits, please specify `auth_token` in config."
381375
)
382-
return result
376+
return request

0 commit comments

Comments
 (0)