This release is a pre-release and may not be stable for production use.
Python client for OneSignal push notification service
[](https://travis-ci.org/joaobarbosa/onesignal-python)
## Installing
- ```pip install onesignal-python```
- ```pip install git+https://github.com/joaobarbosa/onesignal-python.git```
## Usage
Example, sending push to specific devices (currently, only way supported).
```python
from requests.exceptions import HTTPError
from onesignalclient.app_client import OneSignalAppClient
from onesignalclient.notification import Notification
player_id = 'sample00-play-er00-id00-000000000000'
os_app_id = 'sample00-app0-id00-0000-000000000000'
os_apikey = 'your-rest-api-key-goes-here'
# Init the client
client = OneSignalAppClient(app_id=os_app_id, app_api_key=os_apikey)
# Creates a new notification
notification = Notification(app_id, Notification.DEVICES_MODE)
notification.include_player_ids = [player_id] # Must be a list!
try:
# Sends it!
result = client.create_notification(notification)
except HTTPError as e:
result = e.response.json()
print(result)
# Success: {'id': '1d63fa3a-2205-314f-a734-a1de7e27cc2a', 'recipients': 1}
# Error: {'errors': ['Invalid app_id format']} - or any other message
```
## Requirements
- Python 3.3+
- ```requirements.txt``` or ```requirements-test.txt```
## Running tests
Using **make**:
```make run_tests```
Using **pytest**:
```py.test --pep8 --cov=. --cov-report=term-missing --cov-config=.coveragerc -r a -v -s```
## Todo
### API Methods
List of API methods to be covered by our client.
**[U]** - requires User Auth | **[A]** - requires App API Key
- [A] Create notification
- Segments mode settings & params
- ~~Devices mode settings & params~~
- Improve tests as new params are added
- Filters mode settings & params
- Common Parameters
- App
- ~~```app_id```~~
- ```app_ids```
- Content
- ~~```contents```~~
- Improve validation
- Behaviour when using ```template_id```
- ~~```headings```~~
- Improve validation
- ```subtitle```
- ```template_id```
- ```content_available```
- ```mutable_content```
- Attachments
- ~~```data```~~
- ```url```
- ```ios_attachments```
- ```big_picture```
- ```adm_big_picture```
- ```chrome_big_picture```
- Appearance
- ~~```ios_badgeType```~~
- ~~```ios_badgeCount```~~
- ~~```small_icon```~~
- ~~```large_icon```~~
- _Others coming soon_
- Export data for request
- [A] Cancel notification
- ~~[U] View apps~~
- ~~[U] View an app~~
- [U] Create an app
- [U] Update an app
- [A] View devices
- View device
- [U] Add a device
- Edit device
- [U] New session
- New purchase
- Increment session length
- [A] CSV export
- ~~Regular export~~
- Extra fields
- Make it available in the user client
- [U] View notification
- [A] View notifications
- Track open
Metadata
Release files for onesignal-python 0.1.0.dev1
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 |
|---|---|---|---|---|
| onesignal-python-0.1.0.dev1.tar.gz | 6.5 kB | Without provenance | Details for onesignal-python-0.1.0.dev1.tar.gz |
Release files / onesignal-python-0.1.0.dev1.tar.gz
| Download URL | onesignal-python-0.1.0.dev1.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c373a3edb99df15fd43447c743426180717005f02f5602293b4c203174dd162a
|
|
BLAKE2b-256 checksum How to use checksums |
d53e263800fe9492fe5db03a2ca7256c34e2fd064f3003baa8abbc982d6f455e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for onesignal-python 0.1.0.dev1
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.