aioexponent
If you have problems with the code in this repository, please file an issue or a pull-request. Thanks!
Installation
pip install aioexponent
Usage
Use to send push notifications to Exponent Experiences from a Python server.
Full documentation on the API is available if you want to dive into the details.
Here's an example on how to use this with retries and reporting via pyrollbar.
from aioexponent import DeviceNotRegisteredError
from aioexponent import PushClient
from aioexponent import PushMessage
from aioexponent import PushResponseError
from aioexponent import PushServerError
from aiohttp import ClientError
# Basic arguments. You should extend this function with the push features you
# want to use, or simply pass in a `PushMessage` object.
async def send_push_message(tokens, message, extra=None):
client = PushClient()
try:
response = await client.publish_multiple([
PushMessage(to=token,
body=message,
data=extra) for token in tokens])
except PushServerError as exc:
# Encountered some likely formatting/validation error.
rollbar.report_exc_info(
extra_data={
'tokens': tokens, 'message': message, 'extra': extra
'errors': exc.errors,
'response_data': exc.response_data,
})
raise
except (ClientError) as exc:
# Encountered some Connection or HTTP error - retry a few times in
# case it is transient.
rollbar.report_exc_info(
extra_data={'tokens': tokens, 'message': message, 'extra': extra})
raise retry(exc=exc)
try:
# We got a response back, but we don't know whether it's an error yet.
# This call raises errors so we can handle them with normal exception
# flows.
response.validate_response()
except DeviceNotRegisteredError:
# Mark the push token as inactive
from notifications.models import PushToken
PushToken.objects.filter(token=token).update(active=False)
except PushResponseError as exc:
# Encountered some other per-notification error.
rollbar.report_exc_info(
extra_data={
'tokens': tokens,
'message': message,
'extra': extra,
'push_response': exc.push_response._asdict(),
})
raise retry(exc=exc)
Metadata
Release files for aioexponent 0.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aioexponent-0.5.2.tar.gz | 5.9 kB | Without provenance | Details for aioexponent-0.5.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aioexponent-0.5.2-py3-none-any.whl | Python 3 | none | any | Details for aioexponent-0.5.2-py3-none-any.whl |
Total release size: 13.4 kB
Release files / aioexponent-0.5.2.tar.gz
| Download URL | aioexponent-0.5.2.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
20aa0724f0e1370f770142995556b3cd1b4a8b30800cc0a1e2485230ce30815a
|
|
BLAKE2b-256 checksum How to use checksums |
fea73bfb4177dea1872b390dda0a30abea36abf72eb21729dc6a39992013740b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.7.1 requests-toolbelt/0.8.0 tqdm/4.19.7 CPython/3.6.7
|
Release files / aioexponent-0.5.2-py3-none-any.whl
| Download URL | aioexponent-0.5.2-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
335d7cbb83c22ab5bfeb34c89800a86fc845af55f0bbcdf0cbe5e9bb98df96ef
|
|
BLAKE2b-256 checksum How to use checksums |
41763f8e9001758f694b7d0fafa2735be3c9027caf80e1efec06ce79617e8305
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.7.1 requests-toolbelt/0.8.0 tqdm/4.19.7 CPython/3.6.7
|
Security for aioexponent 0.5.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.