-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
I'm currently running the master branch in order to test the PR#2540 locally, and I'm getting an exception due to expired token when it's definitely not.
Here is the context and what I do to reproduce:
- I have a Github application bot that I connect to using the following code:
gh_app_auth = github.Auth.AppAuth( app_id=get_github_app_id(), private_key=get_private_key(), jwt_expiry=600 ) gh_app = github.Auth.AppInstallationAuth( app_auth=gh_app_auth, installation_id=int(installation_id), ) rest_github = github.Github( auth=gh_app, )
- When I try to get a repository with
rest_github.get_repo(repository_name)it works the first time. - But if I run the same function again, I will get the following exception:
Traceback (most recent call last): File "<string>", line 1, in <module> File "/opt/miniconda3/envs/my_env/lib/python3.11/site-packages/github/MainClass.py", line 360, in get_repo headers, data = self.__requester.requestJsonAndCheck("GET", url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/miniconda3/envs/my_env/lib/python3.11/site-packages/github/Requester.py", line 431, in requestJsonAndCheck *self.requestJson( ^^^^^^^^^^^^^^^^^ File "/opt/miniconda3/envs/my_env/lib/python3.11/site-packages/github/Requester.py", line 568, in requestJson return self.__requestEncode(cnx, verb, url, parameters, headers, input, encode) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/miniconda3/envs/my_env/lib/python3.11/site-packages/github/Requester.py", line 661, in __requestEncode ] = f"{self.__auth.token_type} {self.__auth.token}" ^^^^^^^^^^^^^^^^^ File "/opt/miniconda3/envs/my_env/lib/python3.11/site-packages/github/Auth.py", line 299, in token if self.__installation_authorization is None or self._is_expired: ^^^^^^^^^^^^^^^^ File "/opt/miniconda3/envs/my_env/lib/python3.11/site-packages/github/Auth.py", line 310, in _is_expired return token_expires_at < datetime.now(timezone.utc) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: can't compare offset-naive and offset-aware datetimes
I have set the jwt_expiry value to 600s, but it doesn't take it into consideration.
Would anyone have a suggestion ?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels