Skip to content

Commit

Permalink
Accept file path or file object
Browse files Browse the repository at this point in the history
  • Loading branch information
danielaRiesgo committed Oct 18, 2024
1 parent 77ac313 commit 3cd2dab
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion aioapns/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ async def _create_connection(
class APNsKeyConnectionPool(APNsBaseConnectionPool):
def __init__(
self,
key_file: str,
key_file: str, # Key path Str or File object
key_id: str,
team_id: str,
topic: str,
Expand All @@ -550,6 +550,8 @@ def __init__(
self.key_id = key_id
self.team_id = team_id

if hasattr(key_file, "read"):
self.key = key_file.read()
with open(key_file) as f:
self.key = f.read()

Expand Down

0 comments on commit 3cd2dab

Please sign in to comment.