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

APNsKeyConnectionPool key_file vs. key #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aioapns/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(
)
elif key and key_id and team_id and topic:
self.pool = APNsKeyConnectionPool(
key_file=key,
key=key,
key_id=key_id,
team_id=team_id,
topic=topic,
Expand Down
6 changes: 2 additions & 4 deletions aioapns/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ async def create_connection(self) -> APNsBaseClientProtocol:
class APNsKeyConnectionPool(APNsBaseConnectionPool):
def __init__(
self,
key_file: str,
key: str,
key_id: str,
team_id: str,
topic: str,
Expand All @@ -498,12 +498,10 @@ def __init__(

self.ssl_context = ssl_context or ssl.create_default_context()

self.key = key
self.key_id = key_id
self.team_id = team_id

with open(key_file) as f:
self.key = f.read()

async def create_connection(self) -> APNsBaseClientProtocol:
auth_provider = JWTAuthorizationHeaderProvider(
key=self.key, key_id=self.key_id, team_id=self.team_id
Expand Down