<commit_before>"""Push notification service

send_message_android and send_message_ios are the same, but this is intentional, in order
to support any future different conditions for both platforms, different keys or addtional parameters
shit happens sometimes ROFL!

"""

from django.conf import settings
from constance import config
import requests


def send_message_android(destination, message, title=config.TITLE_PUSH_NOTIFICATION):
    headers = {
        'Authorization': 'key=' + settings.FIREBASE_SERVER_KEY,
        'Content - Type': 'application/json'
    }
    payload = {
        "to": destination,
        "data": {
            "title": title,
            "detail": message
        }
    }
    request = requests.post(
        settings.FIREBASE_API_URL,
        json=payload,
        headers=headers
    )
    print request.text


def send_message_ios(destination, message, title=config.TITLE_PUSH_NOTIFICATION):
    headers = {
        'Authorization': 'key=' + settings.FIREBASE_SERVER_KEY,
        'Content - Type': 'application/json'
    }
    payload = {
        "to": destination,
        "priority": "high",
        "sound": "default",
        "badge": 1,
        "data": {
            "title": title,
            "detail": message
        }
    }
    request = requests.post(<commit_msg>Change data instead notification for iOS push notification<commit_after>"""Push notification service

send_message_android and send_message_ios are similar, but this is intentional, in order
to support any future different conditions for both platforms, different keys or addtional parameters
shit happens sometimes ROFL!

"""

from django.conf import settings
from constance import config
import requests


def send_message_android(destination, message, title=config.TITLE_PUSH_NOTIFICATION):
    headers = {
        'Authorization': 'key=' + settings.FIREBASE_SERVER_KEY,
        'Content - Type': 'application/json'
    }
    payload = {
        "to": destination,
        "data": {
            "title": title,
            "detail": message
        }
    }
    request = requests.post(
        settings.FIREBASE_API_URL,
        json=payload,
        headers=headers
    )
    print request.text


def send_message_ios(destination, message, title=config.TITLE_PUSH_NOTIFICATION):
    headers = {
        'Authorization': 'key=' + settings.FIREBASE_SERVER_KEY,
        'Content - Type': 'application/json'
    }
    payload = {
        "to": destination,
        "priority": "high",
        "badge": 1,
        "notification": {
            "title": title,
            "text": message,
            "sound": "default",
        }
    }
    request = requests.post(
{'fraction_non_alphanumeric': 0.09988776655443322, 'fraction_numerical': 0.0007482229704451926, 'mean_word_length': 2.628222523744912, 'pattern_counts': {'":': 22, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1841045', 'n_tokens_mistral': 738, 'n_tokens_neox': 728, 'n_words': 197}