-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: allow integer app id #23
Feature: allow integer app id #23
Conversation
Since GitHub application IDs are always integers, it would be nice if the `AppInstallationAuthStrategy` (and similar) classes allowed for `int` types in addition to `str`. We could just replace `str` with `int`, but that wouldn't be backwards compatible, so I decided to just keep both. I can update that though if using `int` only is preferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python 3.8 compatibility
githubkit/auth/app.py
Outdated
@@ -33,7 +33,7 @@ class AppAuth(httpx.Auth): | |||
"""GitHub App or Installation Authentication Hook""" | |||
|
|||
github: "GitHubCore" | |||
app_id: str | |||
app_id: str | int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
app_id: str | int | |
app_id: Union[str, int] |
githubkit/auth/app.py
Outdated
@@ -219,7 +219,7 @@ async def async_auth_flow( | |||
class AppAuthStrategy(BaseAuthStrategy): | |||
"""GitHub App Authentication""" | |||
|
|||
app_id: str | |||
app_id: str | int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
app_id: str | int | |
app_id: Union[str, int] |
githubkit/auth/app.py
Outdated
@@ -266,7 +266,7 @@ def get_auth_flow(self, github: "GitHubCore") -> httpx.Auth: | |||
class AppInstallationAuthStrategy(BaseAuthStrategy): | |||
"""GitHub App Installation Authentication""" | |||
|
|||
app_id: str | |||
app_id: str | int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
app_id: str | int | |
app_id: Union[str, int] |
Thanks for catching that, I write mostly Python 3.10+ code so I'm used to using type unions |
Python 3.10+ typing is so convenient 👍🏻 |
Since GitHub application IDs are always integers, it would be nice if the
AppInstallationAuthStrategy
(and similar) classes allowed forint
types in addition tostr
. We could just replacestr
withint
, but that wouldn't be backwards compatible, so I decided to just keep both. I can update that though if only usingint
is preferred.