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

Stream forcefully closed when trying to execute the sample code #53

Closed
Kianoosh76 opened this issue Sep 3, 2017 · 2 comments
Closed

Comments

@Kianoosh76
Copy link

Kianoosh76 commented Sep 3, 2017

Hi, I tried to run the sample code that is put in the readme file of the project but I faced this error:

Traceback (most recent call last):
  File "//anaconda/envs/lyan/lib/python3.5/code.py", line 91, in runcode
    exec(code, self.locals)
  File "<console>", line 1, in <module>
  File "//anaconda/envs/lyan/lib/python3.5/site-packages/apns2/client.py", line 53, in send_notification
    stream_id = self.send_notification_async(token_hex, notification, topic, priority, expiration, collapse_id)
  File "//anaconda/envs/lyan/lib/python3.5/site-packages/apns2/client.py", line 78, in send_notification_async
    stream_id = self._connection.request('POST', url, json_payload, headers)
  File "//anaconda/envs/lyan/lib/python3.5/site-packages/hyper/http20/connection.py", line 281, in request
    self.endheaders(message_body=body, final=True, stream_id=stream_id)
  File "//anaconda/envs/lyan/lib/python3.5/site-packages/hyper/http20/connection.py", line 546, in endheaders
    stream = self._get_stream(stream_id)
  File "//anaconda/envs/lyan/lib/python3.5/site-packages/hyper/http20/connection.py", line 289, in _get_stream
    raise StreamResetError("Stream forcefully closed")
hyper.http20.exceptions.StreamResetError: Stream forcefully closed

Any idea for solving this problem?
Thanks

@Dubrzr
Copy link

Dubrzr commented Sep 26, 2017

You are probably not using the right certificate (dev vs prod) in accordance with the use_sandbox parameter of APNSClient.
When using the dev certificate, use_sandbox=True
When using the prod certificate, use_sandbox=False

@Kianoosh76
Copy link
Author

You are right! Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants