Skip to content
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

Merged
merged 2 commits into from
Mar 23, 2023

Conversation

dosisod
Copy link
Contributor

@dosisod dosisod commented Mar 22, 2023

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 only using int is preferred.

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.
Copy link
Owner

@yanyongyu yanyongyu left a 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

@@ -33,7 +33,7 @@ class AppAuth(httpx.Auth):
"""GitHub App or Installation Authentication Hook"""

github: "GitHubCore"
app_id: str
app_id: str | int
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
app_id: str | int
app_id: Union[str, int]

@@ -219,7 +219,7 @@ async def async_auth_flow(
class AppAuthStrategy(BaseAuthStrategy):
"""GitHub App Authentication"""

app_id: str
app_id: str | int
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
app_id: str | int
app_id: Union[str, int]

@@ -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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
app_id: str | int
app_id: Union[str, int]

@yanyongyu yanyongyu added the enhancement New feature or request label Mar 23, 2023
@dosisod
Copy link
Contributor Author

dosisod commented Mar 23, 2023

Thanks for catching that, I write mostly Python 3.10+ code so I'm used to using type unions

@yanyongyu
Copy link
Owner

Python 3.10+ typing is so convenient 👍🏻

@yanyongyu yanyongyu changed the title Allow for integer application IDs Feature: allow integer app id Mar 23, 2023
@yanyongyu yanyongyu merged commit e195d41 into yanyongyu:master Mar 23, 2023
@dosisod dosisod deleted the allow-integer-application-ids branch March 23, 2023 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants