A simple Django library for pushing notifications thru Parse.
---
**Comes out of the box with**
* Django REST Framework endpoint for registering a device token thru REST
* Basic tests
## Installation ##
1) Install thru PIP
pip install django-parse-push
2) Add `parse_push` to `settings.INSTALLED_APPS`
```python
INSTALLED_APPS = (
# ...,
parse_push,
)
```
3) Run migrations
python manage.py migrate parse_push
4) Add environment vars
```bash
PARSE_APPLICATION_ID=your_parse_application_id
PARSE_REST_API_KEY=your_parse_api_key
# Optional environment vars
PARSE_API_URL=https://api.parse.com
PARSE_API_VERSION=1
```
5) Add REST endpoint to urls.py
```python
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
# ...
(r'^api/v1/parse-push', include('parse_push.urls')),
# ...
)
```
## Usage ##
###Example 1###
*A simple Django based example*
```python
from django.contrib.auth import get_user_model
User = get_user_model()
user = User.objects.get(email='donald@duck.com')
device = user.device_set.get_latest('created_at')
device.push({'alert': 'Hello World!', 'text': 'Lorem ipsum dolor...'})
```
###Example 2###
*With Django based User model*
```python
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
class User(AbstractBaseUser, PermissionsMixin)
# ...
def get_full_name(self):
""" Returns the full name """
full_name = u"{} {}".format(self.first_name, self.last_name)
return full_name.strip()
def push(self, data):
device = self.device_set.get_latest()
return device.push(data)
```
###Example 3###
*Barebone client, no dependency on Django*
```python
from parse_push.client import get_client
client = get_client()
client.push('ios', 'devicetokenabcdefghijklmnopqstruvwxyz0123456789', {'foo': 'bar'})
```
You can also configure a Client instance with `APPLICATION_ID` and `REST_API_KEY`
```python
client = Client(application_id='applicationidabcdefghijklmn0123456789', rest_api_key='restapikeyabcdefghijklmn0123456789')
```
Metadata
Release files for django-parse-push 0.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 | |
|---|---|---|---|---|
| django-parse-push-0.2.tar.gz | 8.0 kB | Without provenance | Details |
Release files / django-parse-push-0.2.tar.gz
| Download URL | django-parse-push-0.2.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8f2841e2e4a692750cf37a702bf5a612042ad0edd3f72dab6aef1d8b53e6b7dc
|
|
BLAKE2b-256 checksum How to use checksums |
308069dc5e5c1a4a77ef6583a9acc47539af1b42a32d4fd3c6dc3b2021d741d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-parse-push 0.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.